|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-26 10:16 UTC] jani@php.net
[2009-11-26 10:16 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
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 ?>