3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attractionsArray = array( "Services" => array( "Travel & Hotels ~72", "Automotive~119", "Professional Services~71", "Home Services~70", "IT Services & Computer Repair~83", "Health and Medical~69" ), "Restaurants" => array( "American / Eclectic~2", "Cafe~11", "Desserts & Bakery~111" ), "Shopping" => array( "Office Equipment~103", "Department Stores~91", "Cosmetics & Beauty Supply~90", "Musical Instruments & Teachers~102", "Food~87" ), "Entertainment" => array( "Bars/Pubs~48" ), "Travel" => array( "Hotels~129" ) ); foreach($attractionsArray as $key => $innerArray) { sort($innerArray, SORT_STRING); $attractionArray[$key] = $innerArray; } print_r($attractionArray);
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( [Services] => Array ( [0] => Automotive~119 [1] => Health and Medical~69 [2] => Home Services~70 [3] => IT Services & Computer Repair~83 [4] => Professional Services~71 [5] => Travel & Hotels ~72 ) [Restaurants] => Array ( [0] => American / Eclectic~2 [1] => Cafe~11 [2] => Desserts & Bakery~111 ) [Shopping] => Array ( [0] => Cosmetics & Beauty Supply~90 [1] => Department Stores~91 [2] => Food~87 [3] => Musical Instruments & Teachers~102 [4] => Office Equipment~103 ) [Entertainment] => Array ( [0] => Bars/Pubs~48 ) [Travel] => Array ( [0] => Hotels~129 ) )

preferences:
254.49 ms | 407 KiB | 356 Q