Home > Backend Development > PHP Tutorial > 怎么取出old里面对应的值和new对应的值,php二维数组问题

怎么取出old里面对应的值和new对应的值,php二维数组问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:44:01
Original
1100 people have browsed it

怎么取出old里面对应的值和new对应的值,php二维数组问题

回复内容:

怎么取出old里面对应的值和new对应的值,php二维数组问题

这是json_decode出来的stdClass Object么?如果是的话,那你应该设定第二个参数:json_decode($data,true),这样就是一个数组了。

如果不是的话,你应该用(array)强转
这里有份递归转的

function object_array($array){
  if(is_object($array)){
    $array = (array)$array;
  }
  if(is_array($array)){
    foreach($array as $key=>$value){
      $array[$key] = object_array($value);
    }
  }
  return $array;
} 

$array = object_array($data);
Copy after login

眼睛看哪里去了,dump都说的清清楚楚是Object了怎么还是二维数组问题,囧死。
试试 $a->old$a->new 吧。

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template