【发布时间】:2013-06-26 23:54:04
【问题描述】:
我正在尝试制作日记类型的应用程序。因为我希望它按日期排序,所以我将要提取的日期作为键,然后将文本作为数组中的值。我想要做的只是显示一次日期,即使有两个匹配的键。
所以在下面的例子中它会理想地返回:
1/2/2013
entry 1
entry 2
1/5/2013
this is another day
从此输入:
$array = array('1/2/2013'=>'entry 1', '1/2/2013'=>'entry 2',
'1/5/2013'=>'this is another day');
//loop through array and echo the date and value, but only echo date if havent already
【问题讨论】: