Removing a nested array out of a array and assigning to a new variable in php

Okay so i read about multi-dimensional arrays but my problem is such, i am deserializing a JSON string into a php array and the output is such when decoded. Now i want to assign comparisionResultDTOarr to a new array. The name of the array is $data

array (size=1)
  0 => 
    object(stdClass)[1]
      public 'class' => string 'com.ofss.fc.app.ops.config.response.CompareDomainObjectResponse' (length=63)
      public 'comparisonResultDTOarr' => 
        array (size=24)
          0 => 
            object(stdClass)[2]
              ...
          1 => 
            object(stdClass)[5]
              ...
          2 => 
            object(stdClass)[8]
              ...
          3 => 
            object(stdClass)[11]
              ...
          4 => 
            object(stdClass)[14]
              ...
          5 => 
            object(stdClass)[17]
              ...
          6 => 
            object(stdClass)[20]
              ...
          7 => 
            object(stdClass)[23]
              ...
          8 => 
            object(stdClass)[26]
              ...
          9 => 
            object(stdClass)[29]
              ...
          10 => 
            object(stdClass)[32]
              ...
          11 => 
            object(stdClass)[35]
              ...
          12 => 
            object(stdClass)[38]
              ...
          13 => 
            object(stdClass)[41]
              ...
          14 => 
            object(stdClass)[44]
              ...
          15 => 
            object(stdClass)[47]
              ...
          16 => 
            object(stdClass)[50]
              ...
          17 => 
            object(stdClass)[53]
              ...
          18 => 
            object(stdClass)[56]
              ...
          19 => 
            object(stdClass)[59]
              ...
          20 => 
            object(stdClass)[62]
              ...
          21 => 
            object(stdClass)[65]
              ...
          22 => 
            object(stdClass)[68]
              ...
          23 => 
            object(stdClass)[71]
              ...
      public 'configVersionId' => null
      public 'maintenanceType' => null
      public 'percentage' => float 93.103448275862
      public 'resultColor' => string 'GREEN' (length=5)
      public 'status' => null

I tried doing:-

$new_array = $data[0]->['comparisionResultDTOarr'];

but this doesn't seem to work. Can anyone help me out?

链接地址: http://www.djcxy.com/p/57674.html

上一篇: 使用json在php中获取json数组的问题

下一篇: 从数组中移除一个嵌套数组并在php中分配一个新变量