note 113521 added to function.array-keys

From: Date: Thu, 24 Oct 2013 05:17:17 +0000
Subject: note 113521 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-197312@lists.php.net to get a copy of this message
Since 5.4 STRICT standards dictate that you cannot wrap array_keys in a function like array_shift that attempts to reference the array. Invalid: echo array_shift( array_keys( array('a' => 'apple') ) ); Valid: $keys = array_keys( array('a' => 'apple') ); echo array_shift( $keys ); But Wait! Since PHP (currently) allows you to break a reference by wrapping a variable in parentheses, you can currently use: echo array_shift( ( array_keys( array('a' => 'apple') ) ) ); However I would expect in time the PHP team will modify the rules of parentheses. ---- Server IP: 69.147.83.199 Probable Submitter: 50.160.192.137 ---- Manual Page -- http://php.net/manual/en/function.array-keys.php Edit -- https://master.php.net/note/edit/113521 Del: integrated -- https://master.php.net/note/delete/113521/integrated Del: useless -- https://master.php.net/note/delete/113521/useless Del: bad code -- https://master.php.net/note/delete/113521/bad+code Del: spam -- https://master.php.net/note/delete/113521/spam Del: non-english -- https://master.php.net/note/delete/113521/non-english Del: in docs -- https://master.php.net/note/delete/113521/in+docs Del: other reasons-- https://master.php.net/note/delete/113521 Reject -- https://master.php.net/note/reject/113521 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197312) next »