3v4l.org

run code in 500+ PHP versions simultaneously
<?php $bookData = []; foreach ([1, 2, 3, 5, 8, 13, 21] as $value) { $book = new stdClass; $book->price = $value; $bookData[] = $book; } $priceFilter = function($minimumValue, $maximumValue) { return function($value) use ($minimumValue, $maximumValue) { return $value->price >= $minimumValue && $value->price < $maximumValue; }; }; var_dump(array_filter( $bookData, $priceFilter(5.00, 15.00) )); var_dump(array_filter( $bookData, $priceFilter(1.00, 10.00) ));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 11
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/5Z1mY
function name:  (null)
number of ops:  37
compiled vars:  !0 = $bookData, !1 = $value, !2 = $book, !3 = $priceFilter
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    4     1      > FE_RESET_R                                           $5      <array>, ->11
          2    > > FE_FETCH_R                                                   $5, !1, ->11
    5     3    >   NEW                                                  $6      'stdClass'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !2, $6
    6     6        ASSIGN_OBJ                                                   !2, 'price'
          7        OP_DATA                                                      !1
    7     8        ASSIGN_DIM                                                   !0
          9        OP_DATA                                                      !2
    4    10      > JMP                                                          ->2
         11    >   FE_FREE                                                      $5
   10    12        DECLARE_LAMBDA_FUNCTION                              ~11     [0]
         13        ASSIGN                                                       !3, ~11
   17    14        INIT_FCALL                                                   'var_dump'
         15        INIT_FCALL                                                   'array_filter'
   18    16        SEND_VAR                                                     !0
   19    17        INIT_DYNAMIC_CALL                                            !3
         18        SEND_VAL_EX                                                  5
         19        SEND_VAL_EX                                                  15
         20        DO_FCALL                                          0  $13     
         21        SEND_VAR                                                     $13
   17    22        DO_ICALL                                             $14     
   19    23        SEND_VAR                                                     $14
   17    24        DO_ICALL                                                     
   22    25        INIT_FCALL                                                   'var_dump'
         26        INIT_FCALL                                                   'array_filter'
   23    27        SEND_VAR                                                     !0
   24    28        INIT_DYNAMIC_CALL                                            !3
         29        SEND_VAL_EX                                                  1
         30        SEND_VAL_EX                                                  10
         31        DO_FCALL                                          0  $16     
         32        SEND_VAR                                                     $16
   22    33        DO_ICALL                                             $17     
   24    34        SEND_VAR                                                     $17
   22    35        DO_ICALL                                                     
   25    36      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5Z1mY
function name:  {closure:/in/5Z1mY:10}
number of ops:  7
compiled vars:  !0 = $minimumValue, !1 = $maximumValue
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   11     2        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          3        BIND_LEXICAL                                                 ~2, !0
          4        BIND_LEXICAL                                                 ~2, !1
   14     5      > RETURN                                                       ~2
   15     6*     > RETURN                                                       null


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

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.59 ms | 3568 KiB | 15 Q