domingo, 29 de noviembre de 2015

finding if string exist strripos()

Example #1 A simple strripos() example

<?php
$haystack = 'ababcd';
$needle   = 'aB';

$pos      = strripos($haystack, $needle);

if ($pos === false) {
    echo "Sorry, we did not find ($needle) in ($haystack)";
} else {
    echo "Congratulations!\n";
    echo "We found the last ($needle) in ($haystack) at position ($pos)";
}
?>


The above example will output:

   Congratulations!
   We found the last (aB) in (ababcd) at position (2

No hay comentarios:

Publicar un comentario