3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array(1, 2, 3, 4, 5, 6); // Creates a new anonymous function and assigns it to a variable $filter_even = function($item) { return ($item % 2) == 0; }; // Built-in array_filter accepts both the data and the function $output = array_filter($input, $filter_even); // The function doesn't need to be assigned to a variable. This is valid too: $output = array_filter($input, function($item) { return ($item % 2) == 0; }); print_r($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3onj
function name:  (null)
number of ops:  18
compiled vars:  !0 = $input, !1 = $filter_even, !2 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FG3onj%3A6%240'
          2        ASSIGN                                                   !1, ~4
   11     3        INIT_FCALL                                               'array_filter'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
   14     8        INIT_FCALL                                               'array_filter'
          9        SEND_VAR                                                 !0
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FG3onj%3A14%241'
   16    11        SEND_VAL                                                 ~8
         12        DO_ICALL                                         $9      
   14    13        ASSIGN                                                   !2, $9
   18    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FG3onj%3A6%240

Function %00%7Bclosure%7D%2Fin%2FG3onj%3A14%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3onj
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        MOD                                              ~1      !0, 2
          2        IS_EQUAL                                         ~2      ~1, 0
          3      > RETURN                                                   ~2
   16     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FG3onj%3A14%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.09 ms | 1396 KiB | 17 Q