3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function mysort($a,$b){ return strlen($b)-strlen($a); } $data = array("kaushik","kaushik is","kaushik is great","is","is great","great"); usort($data,'mysort'); // print_r($data); $current = ""; for($i=0;$i<count($data);$i++) { $current=$data[$i]; for($j=($i+1);$j<count($data);$j++) { $current=trim(str_replace($data[$j],"",$current)); } if ($current=="") { echo $i.":".$data[$i]."\n"; break; } } ?>
Output for 4.3.0 - 7.1.0
0:kaushik is great