|
Posted by Daz on 10/22/06 10:09
Pedro Graca wrote:
> Pedro Graca wrote:
> > <?php
> > function array_function($needle, $array) {
> > $n = 0;
> > foreach ($array as $value) {
> > if ($needle == $value) return $n;
> > ++$n;
> > }
>
> return false;
>
> > }
> >
> > $data = array('name'=>'forty-two', 'dob'=>'2006-10-21', 'eye-color'=>'brown');
> > $zero_index = (int)array_function('brown', $data);
> >
> > ### if ($zero_index != 2) {
> > ### // error!
> > ### }
> > ?>
Ok, I am happy yo build my own, I could have just swore that I saw a
function that deoes it.
Thanks for your input.
Navigation:
[Reply to this message]
|