Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,109 questions

40,780 answers

573 users

How to sort an array of numbers in ascending order by first digit in PHP

1 Answer

0 votes
$arr = array(11, 32, 17, 42, 13, 100, 25, 92, 91);

sort($arr, SORT_STRING);

print_r($arr);


/*
run:

Array
(
    [0] => 100
    [1] => 11
    [2] => 13
    [3] => 17
    [4] => 25
    [5] => 32
    [6] => 42
    [7] => 91
    [8] => 92
)

*/

 





answered Mar 28, 2021 by avibootz

Related questions

...