3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test($input){ $len = count($input); for($a = 0; $a < $len; $a++){ for($b = 0; $b < $len; $b++){ if($input[$a] === strrev($input[$b]) || $input[$b] === strrev($input[$a]) && $input[$a] === $input[$b]){ $str = $input[$b]; $pos = ceil(strlen($str) / 2) - 1; return $b." ".substr($str, $pos, 1); } } } } $input = array("abc", "def", "feg", "cba"); echo test($input)."\n"; ?>
Output for 4.3.0 - 7.3.0beta1
3 b