3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array( json_decode('{"name": "foo1", "other": "test"}'), json_decode('{"name": "foo2", "other": "test"}'), json_decode('{"name": "foo3", "other": "test"}'), ); echo "INPUT\n", str_repeat('=', 20), "\n"; var_dump($input); echo "\n"; echo "RESULT\n", str_repeat('=', 20), "\n"; var_dump( $result = array_filter($input, function($o) use ($name) { return $o->name == $name; }) ); echo "usage\n", str_repeat('=', 20), "\n"; $match = $result[0]; var_dump($match->other);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wh6D1
function name:  (null)
number of ops:  55
compiled vars:  !0 = $input, !1 = $result, !2 = $name, !3 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%7B%22name%22%3A+%22foo1%22%2C+%22other%22%3A+%22test%22%7D'
          2        DO_ICALL                                         $4      
          3        INIT_ARRAY                                       ~5      $4
    7     4        INIT_FCALL                                               'json_decode'
          5        SEND_VAL                                                 '%7B%22name%22%3A+%22foo2%22%2C+%22other%22%3A+%22test%22%7D'
          6        DO_ICALL                                         $6      
          7        ADD_ARRAY_ELEMENT                                ~5      $6
    8     8        INIT_FCALL                                               'json_decode'
          9        SEND_VAL                                                 '%7B%22name%22%3A+%22foo3%22%2C+%22other%22%3A+%22test%22%7D'
         10        DO_ICALL                                         $7      
         11        ADD_ARRAY_ELEMENT                                ~5      $7
    5    12        ASSIGN                                                   !0, ~5
   10    13        ECHO                                                     'INPUT%0A'
         14        INIT_FCALL                                               'str_repeat'
         15        SEND_VAL                                                 '%3D'
         16        SEND_VAL                                                 20
         17        DO_ICALL                                         $9      
         18        ECHO                                                     $9
         19        ECHO                                                     '%0A'
   11    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
   12    23        ECHO                                                     '%0A'
   13    24        ECHO                                                     'RESULT%0A'
         25        INIT_FCALL                                               'str_repeat'
         26        SEND_VAL                                                 '%3D'
         27        SEND_VAL                                                 20
         28        DO_ICALL                                         $11     
         29        ECHO                                                     $11
         30        ECHO                                                     '%0A'
   14    31        INIT_FCALL                                               'var_dump'
   15    32        INIT_FCALL                                               'array_filter'
         33        SEND_VAR                                                 !0
         34        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWh6D1%3A15%240'
         35        BIND_LEXICAL                                             ~12, !2
         36        SEND_VAL                                                 ~12
         37        DO_ICALL                                         $13     
         38        ASSIGN                                           ~14     !1, $13
         39        SEND_VAL                                                 ~14
         40        DO_ICALL                                                 
   18    41        ECHO                                                     'usage%0A'
         42        INIT_FCALL                                               'str_repeat'
         43        SEND_VAL                                                 '%3D'
         44        SEND_VAL                                                 20
         45        DO_ICALL                                         $16     
         46        ECHO                                                     $16
         47        ECHO                                                     '%0A'
   20    48        FETCH_DIM_R                                      ~17     !1, 0
         49        ASSIGN                                                   !3, ~17
   21    50        INIT_FCALL                                               'var_dump'
         51        FETCH_OBJ_R                                      ~19     !3, 'other'
         52        SEND_VAL                                                 ~19
         53        DO_ICALL                                                 
         54      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FWh6D1%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wh6D1
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $o, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_OBJ_R                                      ~2      !0, 'name'
          3        IS_EQUAL                                         ~3      !1, ~2
          4      > RETURN                                                   ~3
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FWh6D1%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.48 ms | 1400 KiB | 21 Q