<?php
function mysort($a,$b){
return strlen($b)-strlen($a);
}
//$data = array("kaushik","kaushik is","kaushik is great","is","is great","great");
$data = array("usb","pc","cam 168","cam","168");
usort($data,'mysort');
// print_r($data);
$current = "";
for($i=0;$i<count($data);$i++)
{
$current=$data[$i];
for($j=0;$j<count($data);$j++)
{
if($i<>$j)
{
if(str_replace($data[$j],"",$current))!=$current
{
$data[$j]="";
};
}
}
}
print_r($data);
?>
- Output for 5.4.0 - 5.4.26
- Parse error: syntax error, unexpected '!=' (T_IS_NOT_EQUAL) in /in/6lnXg on line 24
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected T_IS_NOT_EQUAL in /in/6lnXg on line 24
Process exited with code 255.
preferences:
181.15 ms | 1395 KiB | 63 Q