3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $testArray = array('PW_PG3_COKE_A.jpg','2DAYSALEGATE_PG2.jpg','PWBY4_DELI-1.jpg','PW_PG2_COKE_A.jpg','2DAYSALEGATE_PG1.jpg','722_PG1.jpg'); sort($testArray, SORT_NATURAL | SORT_FLAG_CASE); print_r($testArray);
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 2DAYSALEGATE_PG1.jpg [1] => 2DAYSALEGATE_PG2.jpg [2] => 722_PG1.jpg [3] => PWBY4_DELI-1.jpg [4] => PW_PG2_COKE_A.jpg [5] => PW_PG3_COKE_A.jpg )
Output for 4.3.0 - 5.3.29
Notice: Use of undefined constant SORT_NATURAL - assumed 'SORT_NATURAL' in /in/dkLPS on line 4 Notice: Use of undefined constant SORT_FLAG_CASE - assumed 'SORT_FLAG_CASE' in /in/dkLPS on line 4 Warning: sort() expects parameter 2 to be long, string given in /in/dkLPS on line 4 Array ( [0] => PW_PG3_COKE_A.jpg [1] => 2DAYSALEGATE_PG2.jpg [2] => PWBY4_DELI-1.jpg [3] => PW_PG2_COKE_A.jpg [4] => 2DAYSALEGATE_PG1.jpg [5] => 722_PG1.jpg )