note 119202 added to function.array-keys
| From: | ayyappan dot ashok at gmail dot com | Date: | Tue, 19 Apr 2016 06:18:35 +0000 |
| Subject: | note 119202 added to function.array-keys | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205271@lists.php.net to get a copy of this message | ||
Post By Sven (59892) has to be changed
$array = array('first'=>'111', 'second'=>'222',
'third'=>'333');
$rarray = array_keys($array);
print array_shift($rarray); // first
print array_pop($rarray); //thrid
print array_shift($rarray); //second
print array_pop($rarray); // no result
Code below is not valid from 5.4.0
print array_shift(array_keys($array)); Throws Strict Standards Error
Sven code works fine till 5.3.29. From 5.4.0 the standards have been changed and results too
differ.
Note :
Strict Standards : Only variables should be passed by reference
Please have look of the code in different versions
http://sandbox.onlinephpfunctions.com/code/24b5fddf14b635f1e37db69a7edffc2cbbed55e1
http://sandbox.onlinephpfunctions.com/code/f695e8f81e906b4f062b66cf9b3b83b6b620464c
----
Server IP: 72.52.91.14
Probable Submitter: 182.72.236.105
----
Manual Page -- http://php.net/manual/en/function.array-keys.php
Edit -- https://master.php.net/note/edit/119202
Del: integrated -- https://master.php.net/note/delete/119202/integrated
Del: useless -- https://master.php.net/note/delete/119202/useless
Del: bad code -- https://master.php.net/note/delete/119202/bad+code
Del: spam -- https://master.php.net/note/delete/119202/spam
Del: non-english -- https://master.php.net/note/delete/119202/non-english
Del: in docs -- https://master.php.net/note/delete/119202/in+docs
Del: other reasons-- https://master.php.net/note/delete/119202
Reject -- https://master.php.net/note/reject/119202
Search -- https://master.php.net/manage/user-notes.php