- substr: documentation ( source)
- var_dump: documentation ( source)
- strpos: documentation ( source)
- test2: documentation ( source)
<?php
function test($str, $substr) {
echo strpos(substr($str,1), $substr);
return strpos(substr($str,1), $substr) >= 0;
}
function test2($str, $substr) {
return strpos($str, $substr) > 0;
}
$str = 'hello';
$sub = 'he';
var_dump(
test($str, $sub),
test2($str, $sub)
);
?>