note 70940 added to function.array-slice

From: Date: Sun, 05 Nov 2006 11:49:34 +0000
Subject: note 70940 added to function.array-slice
Groups: php.notes 
Request: Send a blank email to php-notes+get-119404@lists.php.net to get a copy of this message
This function can also be used for pure laziness, <?php $myVar = end(array_slice(anotherFunction(), 0, 1)); ?> Imagine that anotherFunction() returns, say, three indexes, and you are sure you only want the Nth index, you could use this as a poor man's way of getting by the fact that PHP can't do this: <?php $myVar = (anotherFunction())[1]; ?> Which is sad. ---- Server IP: 193.27.201.10 (proxied: 193.27.201.10 1.0 www1.shellkonto.se:3128 (squid/2.5.STABLE4)) Probable Submitter: 80.217.189.168 ---- Manual Page -- http://www.php.net/manual/en/function.array-slice.php Edit -- https://master.php.net/note/edit/70940 Del: integrated -- https://master.php.net/note/delete/70940/integrated Del: useless -- https://master.php.net/note/delete/70940/useless Del: bad code -- https://master.php.net/note/delete/70940/bad+code Del: spam -- https://master.php.net/note/delete/70940/spam Del: non-english -- https://master.php.net/note/delete/70940/non-english Del: in docs -- https://master.php.net/note/delete/70940/in+docs Del: other reasons-- https://master.php.net/note/delete/70940 Reject -- https://master.php.net/note/reject/70940 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119404) next »