3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; } $sweetsThief = function (Kitchen $kitchen) { return $kitchen->yummy; }; $kitchen = new Kitchen(); $sweetsThief = Closure::bind($sweetsThief, null, $kitchen); for ($i = 0; $i < 100000; $i += 1) { $sweetsThief = Closure::bind(function (Kitchen $kitchen) { return $kitchen->yummy; }, null, 'Kitchen'); } $kitchen = new Kitchen(); $sweetsThief = Closure::bind($sweetsThief, null, $kitchen); for ($i = 0; $i < 100000; $i += 1) { $sweetsThief = new ReflectionProperty('Kitchen', 'yummy'); $sweetsThief->setAccessible(true); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 34
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 34
Branch analysis from position: 45
Branch analysis from position: 34
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
Branch analysis from position: 13
filename:       /in/7O4UJ
function name:  (null)
number of ops:  46
compiled vars:  !0 = $sweetsThief, !1 = $kitchen, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7O4UJ%3A8%240'
          1        ASSIGN                                                   !0, ~3
   12     2        NEW                                              $5      'Kitchen'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   14     5        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 null
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !0, $8
   17    11        ASSIGN                                                   !2, 0
         12      > JMP                                                      ->21
   18    13    >   INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         14        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7O4UJ%3A18%241'
   20    15        SEND_VAL                                                 ~11
         16        SEND_VAL                                                 null
         17        SEND_VAL                                                 'Kitchen'
         18        DO_FCALL                                      0  $12     
   18    19        ASSIGN                                                   !0, $12
   17    20        ASSIGN_OP                                     1          !2, 1
         21    >   IS_SMALLER                                               !2, 100000
         22      > JMPNZ                                                    ~15, ->13
   23    23    >   NEW                                              $16     'Kitchen'
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !1, $16
   25    26        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         27        SEND_VAR                                                 !0
         28        SEND_VAL                                                 null
         29        SEND_VAR                                                 !1
         30        DO_FCALL                                      0  $19     
         31        ASSIGN                                                   !0, $19
   27    32        ASSIGN                                                   !2, 0
         33      > JMP                                                      ->43
   28    34    >   NEW                                              $22     'ReflectionProperty'
         35        SEND_VAL_EX                                              'Kitchen'
         36        SEND_VAL_EX                                              'yummy'
         37        DO_FCALL                                      0          
         38        ASSIGN                                                   !0, $22
   29    39        INIT_METHOD_CALL                                         !0, 'setAccessible'
         40        SEND_VAL_EX                                              <true>
         41        DO_FCALL                                      0          
   27    42        ASSIGN_OP                                     1          !2, 1
         43    >   IS_SMALLER                                               !2, 100000
         44      > JMPNZ                                                    ~27, ->34
   30    45    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F7O4UJ%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7O4UJ
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $kitchen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_OBJ_R                                      ~1      !0, 'yummy'
          2      > RETURN                                                   ~1
   10     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7O4UJ%3A8%240

Function %00%7Bclosure%7D%2Fin%2F7O4UJ%3A18%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7O4UJ
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $kitchen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        FETCH_OBJ_R                                      ~1      !0, 'yummy'
          2      > RETURN                                                   ~1
   20     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7O4UJ%3A18%241

Class Kitchen: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.68 ms | 1399 KiB | 13 Q