- strpos: documentation ( source)
<?php
$search = 'Hello world.';
$test = 'world';
$pos = strpos($search, $test);
echo $pos + "\r\n";
if (!$pos)
echo "1. Not found";
else
echo "1. Found";
echo "\r\n";
if ($pos != true)
echo "2. Not found";
else
echo "2. Found";
echo "\r\n";
if ($pos === false)
echo "3. Not found";
else
echo "3. Found";
echo "\r\n";
if ($pos == false)
echo "4. Not found";
else
echo "4. Found";
?>