3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = file_get_contents('https://my.tradebuilders.com.au/Ajax/Members/?GetSupplierInfo=Yes'); $array = json_decode($json, true); $array = array_filter($array, function (array $values) { return recursive_assoc_in_array($values, ['S' => 6026]); }); print_r($json); function recursive_assoc_in_array(array $haystack, array $needle, $childKey = 'ChildCats') { if (array_intersect_assoc($haystack, $needle)) { return true; } if (!isset($haystack[$childKey]) || !is_array($haystack[$childKey])) { return false; } foreach ($haystack[$childKey] as $child) { if (recursive_assoc_in_array($child, $needle, $childkey)) { return true; } } return false; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FhXjj
function name:  (null)
number of ops:  19
compiled vars:  !0 = $json, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'file_get_contents'
          1        SEND_VAL                                                 'https%3A%2F%2Fmy.tradebuilders.com.au%2FAjax%2FMembers%2F%3FGetSupplierInfo%3DYes'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    5     4        INIT_FCALL                                               'json_decode'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
    7     9        INIT_FCALL                                               'array_filter'
         10        SEND_VAR                                                 !1
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFhXjj%3A7%240'
    9    12        SEND_VAL                                                 ~6
         13        DO_ICALL                                         $7      
    7    14        ASSIGN                                                   !1, $7
   11    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   27    18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFhXjj%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FhXjj
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL_BY_NAME                                       'recursive_assoc_in_array'
          2        SEND_VAR_EX                                              !0
          3        SEND_VAL_EX                                              <array>
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
    9     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFhXjj%3A7%240

Function recursive_assoc_in_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 47) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 30
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 16
filename:       /in/FhXjj
function name:  recursive_assoc_in_array
number of ops:  33
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $childKey, !3 = $child, !4 = $childkey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      'ChildCats'
   15     3        INIT_FCALL                                               'array_intersect_assoc'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7      > JMPZ                                                     $5, ->9
   16     8    > > RETURN                                                   <true>
   18     9    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !0, !2
         10        BOOL_NOT                                         ~7      ~6
         11      > JMPNZ_EX                                         ~7      ~7, ->16
         12    >   FETCH_DIM_R                                      ~8      !0, !2
         13        TYPE_CHECK                                  128  ~9      ~8
         14        BOOL_NOT                                         ~10     ~9
         15        BOOL                                             ~7      ~10
         16    > > JMPZ                                                     ~7, ->18
   19    17    > > RETURN                                                   <false>
   21    18    >   FETCH_DIM_R                                      ~11     !0, !2
         19      > FE_RESET_R                                       $12     ~11, ->30
         20    > > FE_FETCH_R                                               $12, !3, ->30
   22    21    >   INIT_FCALL_BY_NAME                                       'recursive_assoc_in_array'
         22        SEND_VAR_EX                                              !3
         23        SEND_VAR_EX                                              !1
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0  $13     
         26      > JMPZ                                                     $13, ->29
   23    27    >   FE_FREE                                                  $12
         28      > RETURN                                                   <true>
   21    29    > > JMP                                                      ->20
         30    >   FE_FREE                                                  $12
   26    31      > RETURN                                                   <false>
   27    32*     > RETURN                                                   null

End of function recursive_assoc_in_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.83 ms | 1400 KiB | 23 Q