|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-08-19 18:33 UTC] jordandoyle133 at gmail dot com
Description: ------------ Accessing minus keys should start from the end of the array much like the behavior in Perl or Python Test script: --------------- <?php echo [1, 2, 3][-1] . PHP_EOL; echo [3, 2, 1][-2] . PHP_EOL; echo ['foo', 'bar'][-1] . PHP_EOL; Expected result: ---------------- 3 2 bar PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 19:00:01 2025 UTC |
This is not possible, because -1 is a valid array key. Consider: echo [-1 => -1, 0, 1, 2][-1]; // int(-1)