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

好吧,所以我读了多维数组,但我的问题是这样的,我反序列化一个JSON字符串到一个PHP数组和解码输出。 现在我想将comparisionResultDTOarr分配给一个新数组。 数组的名称是$ 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

我试着做: -

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

但这似乎并不奏效。 谁能帮我吗?

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

上一篇: Removing a nested array out of a array and assigning to a new variable in php

下一篇: puzzled by format of PHP multi dimensional array