3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Creates an anonymous filter function accepting items > $min * * Returns a single filter out of a family of "greater than n" filters */ function criteria_greater_than($min) { return function($itemio) use ($min) { var_dump($itemio); return $itemio > $min; }; } $input = array(1, 2, 3, 4, 5, 6); // Use array_filter on a input with a selected filter function $output = array_filter($input, criteria_greater_than(3)); print_r($output); // items > 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9k7gh
function name:  (null)
number of ops:  13
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        INIT_FCALL                                               'criteria_greater_than'
          4        SEND_VAL                                                 3
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   20     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function criteria_greater_than:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9k7gh
function name:  criteria_greater_than
number of ops:  5
compiled vars:  !0 = $min
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9k7gh%3A9%240'
          2        BIND_LEXICAL                                             ~1, !0
   12     3      > RETURN                                                   ~1
   13     4*     > RETURN                                                   null

End of function criteria_greater_than

Function %00%7Bclosure%7D%2Fin%2F9k7gh%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9k7gh
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $itemio, !1 = $min
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   11     5        IS_SMALLER                                       ~3      !1, !0
          6      > RETURN                                                   ~3
   12     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9k7gh%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.66 ms | 1399 KiB | 20 Q