<?php
$fruits = array("apple","orange","papaya","grape","apple juice", "applecurd");
$content = "eaplp";
$content = str_split($content);
$count = count($content);
Foreach($fruits as $fruit){
$arr_fruit = str_split($fruit);
$SortCont = array_merge(array_intersect($arr_fruit, $content), array_diff($content, $arr_fruit));
If(array_slice($SortCont, 0, $count) == array_slice($arr_fruit, 0, $count)){
Echo "match: " . $fruit ."\n";
}
}
preferences:
50.12 ms | 402 KiB | 5 Q