3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{"countries":[{"name":"United States","code":"US"}]},{"countries":[{"name":"United Kingdom","code":"UK"}]},{"countries":[{"name":"Canada","code":"CA"}]}]'; $decode = json_decode($json,1); $new = array_filter($decode, function ($var) { return ($var['countries'][0]['code'] != 'US'); }); print_r($new);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LtPEl
function name:  (null)
number of ops:  16
compiled vars:  !0 = $json, !1 = $decode, !2 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%22countries%22%3A%5B%7B%22name%22%3A%22United+States%22%2C%22code%22%3A%22US%22%7D%5D%7D%2C%7B%22countries%22%3A%5B%7B%22name%22%3A%22United+Kingdom%22%2C%22code%22%3A%22UK%22%7D%5D%7D%2C%7B%22countries%22%3A%5B%7B%22name%22%3A%22Canada%22%2C%22code%22%3A%22CA%22%7D%5D%7D%5D'
    4     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        INIT_FCALL                                               'array_filter'
          7        SEND_VAR                                                 !1
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLtPEl%3A5%240'
    7     9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
    5    11        ASSIGN                                                   !2, $7
    8    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLtPEl%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LtPEl
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_DIM_R                                      ~1      !0, 'countries'
          2        FETCH_DIM_R                                      ~2      ~1, 0
          3        FETCH_DIM_R                                      ~3      ~2, 'code'
          4        IS_NOT_EQUAL                                     ~4      ~3, 'US'
          5      > RETURN                                                   ~4
    7     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLtPEl%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.19 ms | 1396 KiB | 19 Q