Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 26th, 2003, 05:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default 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
__________________
www.campusgrind.com - college portal
 
Old July 28th, 2003, 06:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old April 7th, 2016, 01:16 PM
Registered User
 
Join Date: Mar 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 2dimention arrays and grids

How do i assign values in a grid I.e row an column





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help With Arrays Crippy Ruby 2 March 6th, 2013 05:59 PM
arrays ozPATT Excel VBA 2 November 4th, 2005 06:11 AM
Multidemmesional Arrays OR arrays gmoney060 Classic ASP Basics 3 November 1st, 2004 03:42 PM
Arrays tajin Excel VBA 0 June 20th, 2004 09:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.