note 113688 added to function.array-keys

From: Date: Sat, 16 Nov 2013 04:06:52 +0000
Subject: note 113688 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-197538@lists.php.net to get a copy of this message
If an array is empty (but defined), or the $search_value is not found in the array, an empty array is returned (not false, null, or -1). This may seem intuitive, especially given the documentation says an array is returned, but I needed to sanity test to be sure: <?php $emptyArray = array(); var_dump(array_keys($emptyArray,99)); // array (size=0) \ empty $filledArray = array(11,22,33,42); var_dump(array_keys($filledArray,99)); // array (size=0) \ empty ?> ---- Server IP: 64.71.164.2 Probable Submitter: 68.14.229.34 ---- Manual Page -- http://php.net/manual/en/function.array-keys.php Edit -- https://master.php.net/note/edit/113688 Del: integrated -- https://master.php.net/note/delete/113688/integrated Del: useless -- https://master.php.net/note/delete/113688/useless Del: bad code -- https://master.php.net/note/delete/113688/bad+code Del: spam -- https://master.php.net/note/delete/113688/spam Del: non-english -- https://master.php.net/note/delete/113688/non-english Del: in docs -- https://master.php.net/note/delete/113688/in+docs Del: other reasons-- https://master.php.net/note/delete/113688 Reject -- https://master.php.net/note/reject/113688 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197538) next »