3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ValueFilter { private $minimumValue; private $maximumValue; public function __construct($min, $max) { $this->minimumValue = $min; $this->maximumValue = $max; } public function __invoke($value) { return $value >= $this->minimumValue && $value < $this->maximumValue; } } $values = [1, 2, 3, 5, 8, 13, 21]; print_r(array_filter($values, new ValueFilter(5, 20))); print_r(array_filter($values, new ValueFilter(2, 6)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iHpuS
function name:  (null)
number of ops:  24
compiled vars:  !0 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        NEW                                              $2      'ValueFilter'
          5        SEND_VAL_EX                                              5
          6        SEND_VAL_EX                                              20
          7        DO_FCALL                                      0          
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
   21    12        INIT_FCALL                                               'print_r'
         13        INIT_FCALL                                               'array_filter'
         14        SEND_VAR                                                 !0
         15        NEW                                              $6      'ValueFilter'
         16        SEND_VAL_EX                                              2
         17        SEND_VAL_EX                                              6
         18        DO_FCALL                                      0          
         19        SEND_VAR                                                 $6
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class ValueFilter:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iHpuS
function name:  __construct
number of ops:  7
compiled vars:  !0 = $min, !1 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN_OBJ                                               'minimumValue'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'maximumValue'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/iHpuS
function name:  __invoke
number of ops:  9
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        FETCH_OBJ_R                                      ~1      'minimumValue'
          2        IS_SMALLER_OR_EQUAL                              ~2      ~1, !0
          3      > JMPZ_EX                                          ~2      ~2, ->7
   14     4    >   FETCH_OBJ_R                                      ~3      'maximumValue'
          5        IS_SMALLER                                       ~4      !0, ~3
          6        BOOL                                             ~2      ~4
          7    > > RETURN                                                   ~2
   15     8*     > RETURN                                                   null

End of function __invoke

End of class ValueFilter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.76 ms | 1400 KiB | 17 Q