如何在php中对数组进行排序?

时间:2019-02-13 02:47:26

标签: php arrays

这是我生成阵列的示例代码

<?php
$data = array(array('title' => 'product1','mrp' => 30 , 'qty'=> 1 , 'date' => '2019-01-12'),array('title' => 'product1','mrp' => 30 , 'qty'=> 2 , 'date' => '2019-01-13'),array('title' => 'product1','mrp' => 30 , 'qty'=> 3 , 'date' => '2019-01-15'),array('title' => 'product2','mrp' => 10 , 'qty'=> 4 , 'date' => '2019-01-12'));
?>

其他是

<?php
$data = array(array('title' => 'product1', 'detail' => array( array('mrp' => 30 , 'qty'=> 1 , 'date' => '2019-01-12'),array('mrp' => 30 , 'qty'=> 2 , 'date' => '2019-01-13'), array('product1','mrp' => 30 , 'qty'=> 3 , 'date' => '2019-01-15')), array('title' => 'product2', 'detail' => array( array('mrp' => 10 , 'qty'=> 4 , 'date' => '2019-01-12') ) );
?>

我的问题是如何根据给定的代码对数组进行排序?谢谢!

0 个答案:

没有答案