You are here: Re: Ordering array won't work? « PHP Programming Language « IT news, forums, messages
Re: Ordering array won't work?

Posted by Andy Hassall on 10/25/06 19:07

On 25 Oct 2006 11:29:15 -0700, "frizzle" <phpfrizzle@gmail.com> wrote:

>Andy Hassall wrote:
>> On 25 Oct 2006 11:06:14 -0700, "frizzle" <phpfrizzle@gmail.com> wrote:
>>
>>>I want to scan a dir, put the *.gif into an array, and order that (
>>>01.gif, 02.gif etc),
>>>and put that array into a $_session-array. (Session & Headers are
>>>initiated before this code)
>>>I have the code below, everything works, except for the ordering.
>>>
>>> $filename = preg_replace( "/\.gif$/", '', $file );
>>> $_SESSION['all_pics'][$filename] = "Foobar";
>>>
>>>asort( $_SESSION['all_pics'] );
>>
>> All the values in your array are equal to "Foobar", and so asort doesn't need
>> to do anything to the array to sort it.
>
>I'm sorry, i guess i wasn't clear.
>I want it ordered by it's keys ...
>
>$_SESSION['all_pics'][$filename]

Start at http://uk2.php.net/manual/en/ref.array.php

Look at all the various functions with "sort" in their name. You'll find the
one you want soon enough.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

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

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