3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'state' => [ 'WA', 'CA', 'CA', 'NV', 'MO', 'CA', 'CA', 'CA', 'CT', 'FL', 'FL', 'ID', 'ID', 'IN', 'MN', 'MN', 'NE', 'NY', 'TX', 'TX', 'WI' ], 'counties' => [ 'King, Snohomish', 'Contra Costa', 'Los Angeles', 'Clark', 'Jackson', 'Tulare', 'Sacramento', 'Riverside', 'New Haven', 'Pinellas', 'Lake', 'Canyon', 'Ada', 'Tippecanoe, White, Carroll', 'Crow Wing, Cass', 'Blue Earth', 'Douglas', 'Rockland', 'Webb', 'Harris', 'Waukesha, Milwaukee, Washington' ], 'zipcodes' => [ '98004, 98005, 98006, 98007, 98008, 98011, 98012, 98102, 98105, 98112, 98136, 98025, 98033, 98034, 98083', '94530, 94804, 94805, 94803, 94806, 94564, 94547', '91381, 91384, 91354, 91355, 91321, 91387, 91351, 91390, 91350', '89002, 89009, 89011, 89012, 89014, 89015, 89016, 89128, 89048, 89052, 89053, 89060, 89061, 89074, 94588, 89102, 89105, 89108, 89109, 89111, 89112', '64055, 64056, 64057, 64052, 64064, 64050, 64058, 64014, 64015, 64029, 64063, 64081, 64082, 64086, 64133', '','','','','','','','','','','','','','','','' ] ]; $lowestZips = []; foreach ($array['zipcodes'] as &$zips) { $zips = explode(', ', $zips); sort($zips); $lowestZips[] = $zips[0] ?: PHP_INT_MAX; $zips = implode(', ', $zips); } array_multisort( $lowestZips, $array['zipcodes'], $array['state'], $array['counties'] ); var_export($array);
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array ( 'state' => array ( 0 => 'MO', 1 => 'NV', 2 => 'CA', 3 => 'CA', 4 => 'WA', 5 => 'CA', 6 => 'CA', 7 => 'CA', 8 => 'CT', 9 => 'FL', 10 => 'FL', 11 => 'ID', 12 => 'ID', 13 => 'IN', 14 => 'MN', 15 => 'MN', 16 => 'NE', 17 => 'NY', 18 => 'TX', 19 => 'TX', 20 => 'WI', ), 'counties' => array ( 0 => 'Jackson', 1 => 'Clark', 2 => 'Los Angeles', 3 => 'Contra Costa', 4 => 'King, Snohomish', 5 => 'Riverside', 6 => 'Sacramento', 7 => 'Tulare', 8 => 'New Haven', 9 => 'Lake', 10 => 'Pinellas', 11 => 'Ada', 12 => 'Canyon', 13 => 'Tippecanoe, White, Carroll', 14 => 'Blue Earth', 15 => 'Crow Wing, Cass', 16 => 'Douglas', 17 => 'Rockland', 18 => 'Harris', 19 => 'Webb', 20 => 'Waukesha, Milwaukee, Washington', ), 'zipcodes' => array ( 0 => '64014, 64015, 64029, 64050, 64052, 64055, 64056, 64057, 64058, 64063, 64064, 64081, 64082, 64086, 64133', 1 => '89002, 89009, 89011, 89012, 89014, 89015, 89016, 89048, 89052, 89053, 89060, 89061, 89074, 89102, 89105, 89108, 89109, 89111, 89112, 89128, 94588', 2 => '91321, 91350, 91351, 91354, 91355, 91381, 91384, 91387, 91390', 3 => '94530, 94547, 94564, 94803, 94804, 94805, 94806', 4 => '98004, 98005, 98006, 98007, 98008, 98011, 98012, 98025, 98033, 98034, 98083, 98102, 98105, 98112, 98136', 5 => '', 6 => '', 7 => '', 8 => '', 9 => '', 10 => '', 11 => '', 12 => '', 13 => '', 14 => '', 15 => '', 16 => '', 17 => '', 18 => '', 19 => '', 20 => '', ), )

preferences:
68.17 ms | 1194 KiB | 4 Q