ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-Dev
php-Dev
Re: [PHP-DEV] possible bug in array_reverse() ?
by Markus Fischer other posts by this author
Dec 9 2001 4:11PM messages near this date
[PHP-DEV] possible bug in array_reverse() ? | [PHP-DEV] Bug #14393: Function calling filename built-in access
On Sun, Dec 09, 2001 at 04:27:35PM +0100, Wolfgang Drews wrote : 
>  Hi all,
>  
>  i don't know if i got something wrong, therefore no bug-report, as
>  i don't really know, if this is a bug.
>  
>  ---- snipp ----
>  $ax = array("a" => "alpha", "b" => "bravo", "c" => "charlie",
>              "d" => "delta");
>  $r = array_reverse($ax);
>  print_r($r);
>  
>  for ($i = 0; $i < count($r); $i++)
>  {
>  	echo "<br>".$i." : ".$r[$i];
>  }
>  ---- snap -----

    I don't see the relation to array_reverse() here. The array
    acts and behaves the same after and before array_reverse()
    [except that it is reversed, obviously].
    
>  
>  actually i thougt, PHP handles associative and numeric arrays the
>  same way(internally) as they are hashes and therefore it should be possible
>  to get the values of an associative array through its indices, too.
>  In the example above there are no values printed in the for-loop.
>  Strange behaviour?

    Expected behaviour.
>  
>  In addition the optional Flag "bool preserve_keys" doesn't seem to
>  work on associative arrays. This effect was testet on 4.0.6, 4.2.0 dev
>  and 4.0.5. Can someone please check this or give me a hint in the
>  right direction and open my mind?

    You may be gotten confused that it only works on numerical
    indices.

    - Markus

-- 
Please always Cc to me when replying to me on the lists.

-- 
PHP Development Mailing List <http://www.php.net/> 
To unsubscribe, e-mail: php-dev-unsubscribe@[...].net
For additional commands, e-mail: php-dev-help@[...].net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
Thread:
Wolfgang Drews
Markus Fischer

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved