This article introduces two examples of two-dimensional array sorting in PHP, both of which are relatively simple. It is a good reference for friends who are learning PHP array sorting.
Share a piece of code to implement sorting of two-dimensional arrays in php. Code: <?php /** * 二维数组排序 * by bbs.it-home.org */ $good = array(); for($i = 0; $i<7 ; $i++ ){ $good[$i]['price'] = rand(1,10000); $good[$i]['hot'] = rand(1,100); $good[$i]['follow'] = rand(1,1000); } echo '<pre class="brush:php;toolbar:false">'; print_r($good); echo ' Copy after login '; print_r($good); echo ' Copy after login '; print_r($a); echo ' Copy after login >>> For more information, please view the complete list of php array sorting methods |