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; } } return -1; } echo sub_string("you", "damn you");
based on KrVRQ
Output for 5.6.38 - 7.3.0rc3
0