ID: 50304 Updated by: j...@php.net Reported By: pgreviews at gmail dot com Status: Bogus Bug Type: Feature/Change Request Operating System: Linux PHP Version: 5.3.1 New Comment:
And http://php.net/array_slice :) Previous Comments: ------------------------------------------------------------------------ [2009-11-26 10:16:17] j...@php.net FYI: http://php.net/implode We're not gonna add another function just for this. ------------------------------------------------------------------------ [2009-11-26 00:57:23] pgreviews at gmail dot com Description: ------------ Hey, I have a feature suggestion that would be used with array. You'd simply set your array variable, use a new function (called, say, arygrb, for arraygrab?) and it would echo a part of the array, where you tell it to start and end, that can go across the commas and such. Something like: <?php $array = array("first,"second","third","fourth","fifth"); echo arygrb($array("first","third")<br />); ?> Which would echo: first<br />second<br />third everything up from 'first' to 'third', replacing the "," with <br /> Of course, you could just echo "$array[0] $array[1] $array[2]" but what if it's user input that's in the array? What if you don't know what is in the array, and you're searching it? I think this would be handy. Hope you think so too :) -PG Reproduce code: --------------- --- >From manual page: faq --- <?php $array = array("first,"second","third","fourth","fifth"); echo $array; //Would echo "Array", not good, unless you put $array[1]... echo arygrb($array("first","third")<br />); //Would echo 'first<br />second<br />third, the <br />s actually being line breaks ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50304&edit=1