RE: [PHP] string
| From: | admin at buskirkgraphics dot com | Date: | Mon, 07 Apr 2008 13:30:42 +0000 |
| Subject: | RE: [PHP] string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272618@lists.php.net to get a copy of this message | ||
Do a preg match to find one or preg_match_all to find all the john in the string.
<?php
$name = "John Taylor";
$pattern = '/^John/';
preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3);
print_r($matches);
?>
$name = "John Taylor";
I want to verify if $name contains "john", if yes echo "found";
Cannot remember which to use:
http://ca.php.net/manual/en/ref.strings.php
Sorry,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php