+ 1
How I can sorting words by numbers inside the word?
What kind of sort() I have to use https://code.sololearn.com/wWV2Cl80j2Vy/?ref=app
1 Resposta
+ 1
I can only do it by transforming the original array into an associative array with the number as each item key.
$urutKata = array(9 => "ta9ra", 4 => "ada4lah", 6 => "yudhis6tira", 3 =>"nama3ku", 8 => "di8panggil", 2 => "per2kenalkan", 1 => "ha1llo", 7 => "bia7sa", 5 => "ta5ta");
ksort($urutKata);
foreach($urutKata as $kata)
{
echo "$kata<br />";
}