3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sub_string($pattern, $subject) { $n = strlen($subject); $m = strlen($pattern); for ($i = 0; $i < $n-$m; $i++) { $j = 0; while ($j < $m && $subject[$i+$j] == $pattern[$j]) { $j++; } if ($j == $m){ return 1; }else{ return 0; } } } echo sub_string("hel", "hello");
based on ofYaM
Output for 5.6.38 - 7.3.0rc3
1