php check indexof code example

Example 1: php indexof

strrpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) : int

Example 2: php indexof

strrpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) : int or False return
<?php
$foo = "0123456789a123456789b123456789c";

// Looking for '0' from the 0th byte (from the beginning)
var_dump(strrpos($foo, '0', 0));

// Looking for '0' from the 1st byte (after byte "0")
var_dump(strrpos($foo, '0', 1));

$str = 'This is Main String';
 
if (strpos($str, 'This') !== false) {
    echo 'true';
}

Tags:

Php Example