3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=array( array('id'=>1), array('id'=>2), array('id'=>3), array('id'=>4), ); var_dump($a); $finalResultID=3; $x= array_filter($a, function($el) use($finalResultID) { return $el['id'] == $finalResultID; }); reset($x); var_dump($x);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KHiLg
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $finalResultID, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   11     4        ASSIGN                                                   !1, 3
   12     5        INIT_FCALL                                               'array_filter'
          6        SEND_VAR                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKHiLg%3A12%240'
          8        BIND_LEXICAL                                             ~6, !1
   14     9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
   12    11        ASSIGN                                                   !2, $7
   15    12        INIT_FCALL                                               'reset'
         13        SEND_REF                                                 !2
         14        DO_ICALL                                                 
   16    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FKHiLg%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.41 ms | 1400 KiB | 19 Q