我正在尝试创建日记型应用程序。因为我希望按日期排序,所以我把我拉的日期作为关键字,然后把文本作为数组中的值。我想要做的只是显示一次日期,即使有两个匹配的键。如何仅在未显示数组密钥时才显示数组密钥
所以在下面的例子中,将理想的回报:
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
他可以改变输入吗? – zod
@zod - 也许是一个问题,尽管引用:“我把日期,拉作为关键,然后文本作为数组中的值'听起来像它可以 – AlexP