Re: [PHP] Poping array which has the matching value

2006-12-21 Thread Jochem Maas
Leo Liu wrote: > Hi, > > I wanted to search through the array and pop out the value which match my > search criteria. For example > > If array has {a,b,c,d,e,f} > > I wanna search for "c" and once I found it, took it out from the array. here is a 'solution', you may not understand it fully - i

Re: [PHP] Poping array which has the matching value

2006-12-21 Thread Sumeet
Che Hodgins wrote: Leo, $letters = array('a', 'b', 'c', 'd', 'e', 'f'); $key = array_search('c', $letters); you can also try unset( $letters[$key] ); sumeet $value = array_splice($letters, $key, 1); $value[0] will contain 'c' $letters will contain Array ( [0] => a [1] => b [2] => d [3] =>

Re: [PHP] Poping array which has the matching value

2006-12-20 Thread Che Hodgins
Leo, $letters = array('a', 'b', 'c', 'd', 'e', 'f'); $key = array_search('c', $letters); $value = array_splice($letters, $key, 1); $value[0] will contain 'c' $letters will contain Array ( [0] => a [1] => b [2] => d [3] => e [4] => f ) regards, Che On 12/21/06, Leo Liu <[EMAIL PROTECTED]> wrote

[PHP] Poping array which has the matching value

2006-12-20 Thread Leo Liu
Hi, I wanted to search through the array and pop out the value which match my search criteria. For example If array has {a,b,c,d,e,f} I wanna search for "c" and once I found it, took it out from the array. So the result of the array after operation will be {a,b,d,e,f} If I do array_pop(); fu