PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $strarr = ["zone", "abigail", "theta", "form", "libe", "zas"]; $k = 2; $str = ''; $sorted = array_map(fn($el)=> strlen($el), $strarr); arsort($sorted); $sorted = array_keys($sorted); for($i=0;$i<$k;$i++){ $str .= $strarr[$sorted[$i]]; } echo $str;
Show:  
Copy Clear