Posted by R. Rajesh Jeba Anbiah on 12/17/36 11:55
Phil Latio wrote:
> How do I use wildcards when searching in array? At least that's what I think
> I need !!
>
> I have the line:
>
> if ($attribute[0] != "id")
>
> The above is not 100% correct because it should also be looking for anything
> ending with id. eg. bookid or authorid aswell as just id.
<snip>
FWIW...
<?php
$arr = array('fooid', 'foo_id', 'foo_id_xx');
print_r(array_filter($arr, create_function('$arg', 'return substr($arg,
-2)=="id";')));
?>
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
[Back to original message]
|