You are here: Re: Array question « All PHP « IT news, forums, messages
Re: Array question

Posted by JDS on 06/15/05 23:19

On Tue, 14 Jun 2005 19:00:07 -0700, Captain Dondo wrote:

> In other words, I need to pop the first element of each subarray and
> unshift it to be the first element, while leaving the second element in
> place....
>
> I've been playing with various combinations of array_pop, array_unset, and
> so on but I am complete PHP newbie and I am throughly stuck....
>
> TIA...

To do domething like this you will need to have a temporary "holding"
array

try this...

<?php
$myarray = .... // (array from your OP, not going to retype the whole
thing)

$temparray = array_pop($myarray);

$myarray = array_merge($temparray, $myarray);

?>


Warning! Untested code. But it should work.

--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация