note 74754 added to function.array-flip
| From: | pinkgothic at gmail dot com | Date: | Thu, 26 Apr 2007 08:37:13 +0000 |
| Subject: | note 74754 added to function.array-flip | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125880@lists.php.net to get a copy of this message | ||
In case anyone is wondering how array_flip() treats empty arrays:
<?php
print_r(array_flip(array()));
?>
results in:
Array
(
)
I wanted to know if it would return false and/or even chuck out an error if there were no key-value
pairs to flip, despite being non-intuitive if that were the case. But (of course) everything works
as expected. Just a head's up for the paranoid.
----
Server IP: 217.13.201.10
Probable Submitter: 84.46.119.45
----
Manual Page -- http://www.php.net/manual/en/function.array-flip.php
Edit -- https://master.php.net/note/edit/74754
Del: integrated -- https://master.php.net/note/delete/74754/integrated
Del: useless -- https://master.php.net/note/delete/74754/useless
Del: bad code -- https://master.php.net/note/delete/74754/bad+code
Del: spam -- https://master.php.net/note/delete/74754/spam
Del: non-english -- https://master.php.net/note/delete/74754/non-english
Del: in docs -- https://master.php.net/note/delete/74754/in+docs
Del: other reasons-- https://master.php.net/note/delete/74754
Reject -- https://master.php.net/note/reject/74754
Search -- https://master.php.net/manage/user-notes.php