数组对象去除重复的值
Jun 23, 2016 pm 02:38 PM
1 |
|
我得到一个这样的对象数组,每个数组里面的对象的键要保留,但是post_parent的值相同的,只保留第一个,怎么写函数???
回复讨论(解决方案)
1 |
|
1 |
|
唠叨!哈哈,才知道哦.
大神,我不明白你的$ar是哪里来的。麻烦解释下被。
而且这个$o->post_partent是不是这个多维数组里的所有post_parent的值啊?
还有您这种写法,我很是迷糊。。您是不是又简写了!
1 |
|
1 |
|
我是这样写的,跟你的比真是弱爆了!!为了实现首页幻灯的效果,你看看,已经弄好了。
http://www.tantengvip.com/
1 |
|
唠叨!哈哈,才知道哦.
大神,我不明白你的$ar是哪里来的。麻烦解释下被。
而且这个$o->post_partent是不是这个多维数组里的所有post_parent的值啊?
还有您这种写法,我很是迷糊。。您是不是又简写了!
$ar就是我输出的那一段数组对象
楼主的方法显然是想多了,显得太复杂
1 |
|

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

Simplified HTTP Response Mocking in Laravel Tests

Build a React App With a Laravel Back End: Part 2, React

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon

Announcement of 2025 PHP Situation Survey
