3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NumericComparisonFilter { private $reference; function __construct($reference) { $this->reference = $reference; } function isLower($num) { return $num < $this->reference; } function isGreater($num) { return $num > $this->reference; } function isEqual($num) { return $num == $this->reference; } } $arr = array(7, 8, 9, 10, 11, 12, 13); $matches = array_filter($arr, array(new NumericComparisonFilter(10), 'isLower')); print_r($matches); $matches = array_filter($arr, array(new NumericComparisonFilter(10), 'isGreater')); print_r($matches); $matches = array_filter($arr, array(new NumericComparisonFilter(10), 'isEqual')); print_r($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XlfSn
function name:  (null)
number of ops:  41
compiled vars:  !0 = $arr, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        NEW                                              $3      'NumericComparisonFilter'
          4        SEND_VAL_EX                                              10
          5        DO_FCALL                                      0          
          6        INIT_ARRAY                                       ~5      $3
          7        ADD_ARRAY_ELEMENT                                ~5      'isLower'
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !1, $6
   25    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   27    14        INIT_FCALL                                               'array_filter'
         15        SEND_VAR                                                 !0
         16        NEW                                              $9      'NumericComparisonFilter'
         17        SEND_VAL_EX                                              10
         18        DO_FCALL                                      0          
         19        INIT_ARRAY                                       ~11     $9
         20        ADD_ARRAY_ELEMENT                                ~11     'isGreater'
         21        SEND_VAL                                                 ~11
         22        DO_ICALL                                         $12     
         23        ASSIGN                                                   !1, $12
   28    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
   30    27        INIT_FCALL                                               'array_filter'
         28        SEND_VAR                                                 !0
         29        NEW                                              $15     'NumericComparisonFilter'
         30        SEND_VAL_EX                                              10
         31        DO_FCALL                                      0          
         32        INIT_ARRAY                                       ~17     $15
         33        ADD_ARRAY_ELEMENT                                ~17     'isEqual'
         34        SEND_VAL                                                 ~17
         35        DO_ICALL                                         $18     
         36        ASSIGN                                                   !1, $18
   31    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

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

End of function __construct

Function islower:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XlfSn
function name:  isLower
number of ops:  5
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~1      'reference'
          2        IS_SMALLER                                       ~2      !0, ~1
          3      > RETURN                                                   ~2
   12     4*     > RETURN                                                   null

End of function islower

Function isgreater:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XlfSn
function name:  isGreater
number of ops:  5
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        FETCH_OBJ_R                                      ~1      'reference'
          2        IS_SMALLER                                       ~2      ~1, !0
          3      > RETURN                                                   ~2
   16     4*     > RETURN                                                   null

End of function isgreater

Function isequal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XlfSn
function name:  isEqual
number of ops:  5
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        FETCH_OBJ_R                                      ~1      'reference'
          2        IS_EQUAL                                         ~2      !0, ~1
          3      > RETURN                                                   ~2
   20     4*     > RETURN                                                   null

End of function isequal

End of class NumericComparisonFilter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.48 ms | 1400 KiB | 17 Q