3v4l.org

run code in 300+ 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; }; }; $filteredArrayData = array_filter( $bookData, $priceFilter(5.00, 15.00) ); var_dump($filteredArrayData);
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/4GvWU
function name:  (null)
number of ops:  27
compiled vars:  !0 = $bookData, !1 = $value, !2 = $book, !3 = $priceFilter, !4 = $filteredArrayData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_R                                       $6      <array>, ->11
          2    > > FE_FETCH_R                                               $6, !1, ->11
    5     3    >   NEW                                              $7      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $7
    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                                                  $6
   10    12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F4GvWU%3A10%240'
         13        ASSIGN                                                   !3, ~12
   17    14        INIT_FCALL                                               'array_filter'
   18    15        SEND_VAR                                                 !0
   19    16        INIT_DYNAMIC_CALL                                        !3
         17        SEND_VAL_EX                                              5
         18        SEND_VAL_EX                                              15
         19        DO_FCALL                                      0  $14     
         20        SEND_VAR                                                 $14
         21        DO_ICALL                                         $15     
   17    22        ASSIGN                                                   !4, $15
   22    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F4GvWU%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4GvWU
function name:  {closure}
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                                  '%00%7Bclosure%7D%2Fin%2F4GvWU%3A11%241'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
   14     5      > RETURN                                                   ~2
   15     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F4GvWU%3A10%240

Function %00%7Bclosure%7D%2Fin%2F4GvWU%3A11%241:
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/4GvWU
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2F4GvWU%3A11%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.76 ms | 1400 KiB | 17 Q