note 107624 added to language.types.array

From: Date: Wed, 22 Feb 2012 14:44:21 +0000
Subject: note 107624 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-186276@lists.php.net to get a copy of this message
As mentioned in one of the notes below, it is not possible to do something like this: <?php $a = function_that_returns_an_array()['some_index'] ; ?> However, using anonymous functions, it should be possible to access an element of an array that is returned by a function in a single line. Here is the example. <?php $a = call_user_func(function($arr){return $arr['some_index'];}, function_that_returns_an_array()); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 122.169.252.102 ---- Manual Page -- http://www.php.net/manual/en/language.types.array.php Edit -- https://master.php.net/note/edit/107624 Del: integrated -- https://master.php.net/note/delete/107624/integrated Del: useless -- https://master.php.net/note/delete/107624/useless Del: bad code -- https://master.php.net/note/delete/107624/bad+code Del: spam -- https://master.php.net/note/delete/107624/spam Del: non-english -- https://master.php.net/note/delete/107624/non-english Del: in docs -- https://master.php.net/note/delete/107624/in+docs Del: other reasons-- https://master.php.net/note/delete/107624 Reject -- https://master.php.net/note/reject/107624 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186276) next »