+ 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

31st Oct 2020, 9:06 AM
Tata Yudhistira
Tata Yudhistira - avatar
1 Respuesta
+ 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 />"; }
31st Oct 2020, 11:26 AM
Ipang