|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-06-09 15:35 UTC] mfischer@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 21:00:01 2025 UTC |
$array[] = 1 is not the same as $array[$somenullvalue] = 1. This is not intuitive and undocumented as far as I can tell. Example: --8<-- [armadillo:pgl]:~/public_html/test $ cat test.php <? #!/usr/local/bin/php -q $array[] = 1; $array[] = 2; print_r($array); unset($array); $null = ''; $array[$null] = 3; $array[$null] = 4; print_r($array); ?> --8<-- Prints: --8<-- Array ( [0] => 1 [1] => 2 ) Array ( [] => 4 ) --8<-- I would say this is a documentation problem, but I can't see how this behaviour could be useful. regards, Peter Lowe.