note 124741 added to function.array-keys

From: Date: Thu, 20 Feb 2020 06:19:13 +0000
Subject: note 124741 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-214178@lists.php.net to get a copy of this message
<?php # array_keys() also return the key if it's boolean but the boolean will return as 1 or 0. It will return empty if get NULL value as key. Consider the following array: $a = array( "first_index" => "This is the first element", true => 3, false => 2, 4.5 => 'Something', "08" => 5, "8" => 6, NULL => 'Null key' ); print_r(array_keys($a)); Array ( [0] => first_index [1] => 1 [2] => 0 [3] => 4 [4] => 08 [5] => 8 [6] => ) ?> ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.195 (proxied: 182.160.98.85) ---- Manual Page -- http://php.net/manual/en/function.array-keys.php Edit -- https://master.php.net/note/edit/124741 Del: integrated -- https://master.php.net/note/delete/124741/integrated Del: useless -- https://master.php.net/note/delete/124741/useless Del: bad code -- https://master.php.net/note/delete/124741/bad+code Del: spam -- https://master.php.net/note/delete/124741/spam Del: non-english -- https://master.php.net/note/delete/124741/non-english Del: in docs -- https://master.php.net/note/delete/124741/in+docs Del: other reasons-- https://master.php.net/note/delete/124741 Reject -- https://master.php.net/note/reject/124741 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214178) next »