This one time, at band camp,
"1LT John W. Holmes" <[EMAIL PROTECTED]> wrote:
>
> Very true, I agree. For your solution, though, wouldn't it correctly match a
> string such as '2,3,11,12' even though there is no entry that's just one?
Ok, why not something like this..
There is almost always a better solution than regex
<?php
$string = '98,244,9,243,2,6,36,3,111,';
if(catchOne($string) == 'TRUE'){
echo 'Found a One';
}else{
echo 'No match found';
}
function catchOne($string){
$arr = explode(',', $string);
// check if the 1 is in the array
if(in_array('1', $arr)){
return TRUE;
}else{
return FALSE;
}
}
?>
Kevin
--
______
(_____ \
_____) ) ____ ____ ____ ____
| ____/ / _ ) / _ | / ___) / _ )
| | ( (/ / ( ( | |( (___ ( (/ /
|_| \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php