亚洲精品中文字幕无乱码_久久亚洲精品无码AV大片_最新国产免费Av网址_国产精品3级片

php語言

PHP多維數(shù)組去掉重復(fù)值的方法

時間:2024-08-04 18:13:08 php語言 我要投稿
  • 相關(guān)推薦

PHP多維數(shù)組去掉重復(fù)值的方法

  如果缺少破土面出并與風(fēng)雪拚搏的勇氣,種子的前途并不比落葉美妙一分。以下是小編為大家搜索整理的PHP多維數(shù)組去掉重復(fù)值的方法,希望能給大家?guī)韼椭?更多精彩內(nèi)容請及時關(guān)注我們應(yīng)屆畢業(yè)生考試網(wǎng)!

  代碼如下:

  $json='{

  "rec_items": [

  {

  "classes": "玄幻",

  "gid": 6326585,

  "author": "我吃西紅柿",

  "nid": 10079306,

  "last_sort": 841,

  "last_chapter_name": "第二十五卷 第六章 一掃而空",

  "sub_count": 5364424,

  "novel_name": "莽荒紀(jì)",

  "last_update_time": 1393679718826

  },

  {

  "classes": "玄幻",

  "gid": 6109786,

  "author": "唐家三少",

  "nid": 10079046,

  "last_sort": 1153,

  "last_chapter_name": "第三百八十一章 開始行動(中)",

  "sub_count": 3933876,

  "novel_name": "絕世唐門",

  "last_update_time": 1393681654511

  },

  {

  "classes": "玄幻",

  "gid": 10645516,

  "author": "辰東",

  "nid": 12649548,

  "last_sort": 478,

  "last_chapter_name": "第四百三十二章 扛媳婦回村",

  "sub_count": 1422482,

  "novel_name": "完美世界",

  "last_update_time": 1393681655610

  },

  {

  "classes": "玄幻",

  "gid": 4711723,

  "author": "只是小蝦米",

  "nid": 12629406,

  "last_sort": 2603,

  "last_chapter_name": "第2588章 蘇醒!",

  "sub_count": 2841630,

  "novel_name": "武逆",

  "last_update_time": 1393605899300

  },

  {

  "classes": "玄幻",

  "gid": 3701669,

  "author": "蒼笑天",

  "nid": 8583556,

  "last_sort": 3427,

  "last_chapter_name": "第兩千兩百二十五章 孔雀王!",

  "sub_count": 606473,

  "novel_name": "武破九霄",

  "last_update_time": 1391279170831

  },

  {

  "classes": "玄幻",

  "gid": 8141499,

  "author": "風(fēng)凌天下",

  "nid": 9212380,

  "last_sort": 2579,

  "last_chapter_name": "第五百二十六章 九劫、天帝之戰(zhàn)【七】",

  "sub_count": 3082857,

  "novel_name": "傲世九重天",

  "last_update_time": 1393677692614

  }

  ],

  "cate_book_items": [

  {

  "classes": "玄幻",

  "gid": 4711723,

  "author": "只是小蝦米",

  "nid": 12629406,

  "last_sort": 2603,

  "last_chapter_name": "第2588章 蘇醒!",

  "sub_count": 2841630,

  "novel_name": "武逆",

  "last_update_time": 1393605899300

  },

  {

  "classes": "玄幻",

  "gid": 3701669,

  "author": "蒼笑天",

  "nid": 8583556,

  "last_sort": 3427,

  "last_chapter_name": "第兩千兩百二十五章 孔雀王!",

  "sub_count": 606473,

  "novel_name": "武破九霄",

  "last_update_time": 1391279170831

  },

  {

  "classes": "玄幻",

  "gid": 10645516,

  "author": "辰東",

  "nid": 12649548,

  "last_sort": 478,

  "last_chapter_name": "第四百三十二章 扛媳婦回村",

  "sub_count": 1422482,

  "novel_name": "完美世界",

  "last_update_time": 1393681655610

  }

  ]

  }';

  function mult_unique($array)

  {

  $return = array();

  foreach($array as $key=>$v)

  {

  if(!in_array($v, $return))

  {

  $return[$key]=$v;

  }

  }

  return $return;

  }

  $json = get_object_vars(json_decode($json));

  $data = $json['rec_items'];

  $data = array_merge_recursive($data, $json['cate_book_items']);

  echo '

  ';

  print_r($data);

  echo '';

  print_r(mult_unique($data));

  echo '

  ';

  ?>

【PHP多維數(shù)組去掉重復(fù)值的方法】相關(guān)文章:

php遞歸遍歷多維數(shù)組的方法10-06

php數(shù)組長度的方法10-05

c語言多維數(shù)組地址的表示方法07-31

PHP超全局?jǐn)?shù)組的方法10-29

php正則去掉php注釋07-30

Java數(shù)組特定值高效判斷方法10-03

PHP數(shù)組函數(shù)知識10-24

簡單PHP數(shù)組函數(shù)介紹09-26

PHP數(shù)組長度的技巧09-18

PHP 數(shù)組和字符串互相轉(zhuǎn)換實現(xiàn)方法06-28