this book.";
print("Full text: $text BR>\n");
print("Looking for 'leon':". stristr($text,
"leon"));
?>
integer strlen(string text)
Use the strlen function to get the length of a string.
<?
$text = "a short string";
print("'$text' is ". strlen($text). "
characters long.");
?>
integer strpos(string data, string substring, integer offset)
The strpos function returns the position of the substring argument in the data
argument. If the substring argument is not a string, it will be treated as an ASCII
code. If the substring appears more than once, the position of the first occurrence is
returned. If the substring doesn't exist at all, then FALSE is returned. The optional
offset argument instructs PHP to begin searching after the specified position. Positions
are counted starting with zero.
This function is a good alternative to ereg when you are searching for a simple string. It
carries none of the overhead involved in parsing regular expressions. It is safe for use
with binary strings.
<?
$text = "Hello, World!";
//check for a space
if(strpos($text, 32))
{
print("There is a
space in '$text'
\n");
}
//find where in the string World appears