3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'id' => 1, 'expiry_date' => [ 'foo' => 'bar', 'count' => '(22)', ] ], [ 'id' => 2, 'expiry_date' => [ 'foo' => 'bar', 'count' => '(43)', ] ], [ 'id' => 3, 'expiry_date' => [ 'foo' => 'bar', 'count' => '(5)', ] ], [ 'id' => 4, 'expiry_date' => [ 'foo' => 'bar', 'count' => '(111)', ] ] ]; foreach ($array as $row) { $counts[] = (int) trim($row['expiry_date']['count'], '()'); } array_multisort($counts, $array); var_export($array);
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
array ( 0 => array ( 'id' => 3, 'expiry_date' => array ( 'foo' => 'bar', 'count' => '(5)', ), ), 1 => array ( 'id' => 1, 'expiry_date' => array ( 'foo' => 'bar', 'count' => '(22)', ), ), 2 => array ( 'id' => 2, 'expiry_date' => array ( 'foo' => 'bar', 'count' => '(43)', ), ), 3 => array ( 'id' => 4, 'expiry_date' => array ( 'foo' => 'bar', 'count' => '(111)', ), ), )

preferences:
120.57 ms | 408 KiB | 5 Q