3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "credit_card": { "cvc": "123", "expiry": { "month": "12", "year": "2019" }, "name": "Julian", "number": "5123450000000008", "token": null }, "amount": "10", "currency": "AUD", "gateway": { "line_of_business": "eWallet", "service": "default", "username": null }, "external_id": "my external id", "reference": "julian test", "remitter_name": null, "request_id": "1529561070", "statement_description": null, "security_id": null }'; $array = json_decode($json, true); function array_filter_recursive($array) { $array = array_filter($array); foreach ($array as $key => $value) { if (!is_array($value)) { continue; } $array = array_filter_recursive($value); } return $array; } var_dump(array_filter_recursive($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TrZ1Q
function name:  (null)
number of ops:  13
compiled vars:  !0 = $json, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++%22credit_card%22%3A+%7B%0A++++%22cvc%22%3A+%22123%22%2C%0A++++%22expiry%22%3A+%7B%0A++++++%22month%22%3A+%2212%22%2C%0A++++++%22year%22%3A+%222019%22%0A++++%7D%2C%0A++++%22name%22%3A+%22Julian%22%2C%0A++++%22number%22%3A+%225123450000000008%22%2C%0A++++%22token%22%3A+null%0A++%7D%2C%0A++%22amount%22%3A+%2210%22%2C%0A++%22currency%22%3A+%22AUD%22%2C%0A++%22gateway%22%3A+%7B%0A++++%22line_of_business%22%3A+%22eWallet%22%2C%0A++++%22service%22%3A+%22default%22%2C%0A++++%22username%22%3A+null%0A++%7D%2C%0A++%22external_id%22%3A+%22my+external+id%22%2C%0A++%22reference%22%3A+%22julian+test%22%2C%0A++%22remitter_name%22%3A+null%2C%0A++%22request_id%22%3A+%221529561070%22%2C%0A++%22statement_description%22%3A+null%2C%0A++%22security_id%22%3A+null%0A%7D'
   29     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   48     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'array_filter_recursive'
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function array_filter_recursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/TrZ1Q
function name:  array_filter_recursive
number of ops:  20
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   36     5      > FE_RESET_R                                       $5      !0, ->17
          6    > > FE_FETCH_R                                       ~6      $5, !1, ->17
          7    >   ASSIGN                                                   !2, ~6
   37     8        TYPE_CHECK                                  128  ~8      !1
          9        BOOL_NOT                                         ~9      ~8
         10      > JMPZ                                                     ~9, ->12
   38    11    > > JMP                                                      ->6
   41    12    >   INIT_FCALL_BY_NAME                                       'array_filter_recursive'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0  $10     
         15        ASSIGN                                                   !0, $10
   36    16      > JMP                                                      ->6
         17    >   FE_FREE                                                  $5
   44    18      > RETURN                                                   !0
   45    19*     > RETURN                                                   null

End of function array_filter_recursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.8 ms | 1403 KiB | 20 Q