3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = 'Hi Nemo'; $x1 ='Hello world'; $x2 = 'Nemo James Nemo'; function solution (string $str) { foreach(explode(' ', $str) as $wordNum => $value) { if ($value === 'Nemo') { return 'I found Nemo at ' . $wordNum + 1; } } return 'I can\'t found Nemo'; } var_dump(solution($x1));

preferences:
27.78 ms | 405 KiB | 5 Q