3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a= array("-----------L", "--R---------", "------------", "------------", "------------", "--M---------"); foreach ($a as $k => $v) { if ($p = strpos($v, 'L')) { $res[] = [$k, $p]; } if ($p = strpos($v, 'M')) { $res[] = [$k, $p]; } if ($p = strpos($v, 'R')) { $res[] = [$k, $p]; } } print_r($res);
based on lIBAl
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
Array ( [0] => Array ( [0] => 0 [1] => 11 ) [1] => Array ( [0] => 1 [1] => 2 ) [2] => Array ( [0] => 5 [1] => 2 ) )