3v4l.org

run code in 300+ PHP versions simultaneously
<?php $categories = ' [ { "id":5, "parent_id":0, "image_url":"https://files.cdn.printful.com/o/upload/catalog_category/77/7776d01e716d80e3ffbdebbf3db6b198_t?v=1652883254", "title":"Home & living" }, { "id":6, "parent_id":1, "image_url":"https://files.cdn.printful.com/o/upload/catalog_category/4b/4b37924aaa8e264d1d3cd2a54beb6436_t?v=1652883254", "title":"All shirts" } ] '; $data = json_decode($categories, true); $relevant = array_filter($data, function($entry) { return $entry['parent_id'] !== 0; }); var_dump($relevant);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5psNk
function name:  (null)
number of ops:  16
compiled vars:  !0 = $categories, !1 = $data, !2 = $relevant
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%5B%0A+++%7B%0A++++++%22id%22%3A5%2C%0A++++++%22parent_id%22%3A0%2C%0A++++++%22image_url%22%3A%22https%3A%2F%2Ffiles.cdn.printful.com%2Fo%2Fupload%2Fcatalog_category%2F77%2F7776d01e716d80e3ffbdebbf3db6b198_t%3Fv%3D1652883254%22%2C%0A++++++%22title%22%3A%22Home+%26+living%22%0A+++%7D%2C%0A+++%7B%0A++++++%22id%22%3A6%2C%0A++++++%22parent_id%22%3A1%2C%0A++++++%22image_url%22%3A%22https%3A%2F%2Ffiles.cdn.printful.com%2Fo%2Fupload%2Fcatalog_category%2F4b%2F4b37924aaa8e264d1d3cd2a54beb6436_t%3Fv%3D1652883254%22%2C%0A++++++%22title%22%3A%22All+shirts%22%0A+++%7D%0A%5D%0A'
   20     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   22     6        INIT_FCALL                                               'array_filter'
          7        SEND_VAR                                                 !1
          8        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   24     9        SEND_VAL                                                 ~6
   22    10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
   26    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5psNk
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $entry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        FETCH_DIM_R                                      ~1      !0, 'parent_id'
          2        IS_NOT_IDENTICAL                                 ~2      ~1, 0
          3      > RETURN                                                   ~2
   24     4*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.39 ms | 1005 KiB | 16 Q