p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP How-To (http://p2p.wrox.com/forumdisplay.php?f=98)
-   -   arrays (http://p2p.wrox.com/showthread.php?t=2120)

Moharo July 26th, 2003 05:40 PM

arrays
 
is there a function that will shift its values to different indecies?for example:

myarray = Array();
myarray[0] = 0;
myarray[1] = 1;
myarray[2] = 2;
myarray[3] = 3;

can be changed to:

myarray[0] = 1;
myarray[1] = 2;
myarray[2] = 3;
myarray[3] = 0;

thanks

the genuine genius

Daniel Walker July 28th, 2003 06:41 AM

array_shift and array_push should do this for you. The first will shift your elements up one, with the first element falling off the top of the list. Then array_push, can be used to push that element back on at the bottom.

In fact, PHP has a dizzying set of array functions:
http://www.php.net/manual/en/function.array-shift.php
http://www.php.net/manual/en/function.array-push.php

Moloi Da Wizard April 7th, 2016 01:16 PM

2dimention arrays and grids
 
How do i assign values in a grid I.e row an column


All times are GMT -4. The time now is 07:04 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.