3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { static $r; return $r ?: $r = new ReflectionClass(get_class()); } } $r1 = (new Foo)->bar(); $r2 = (new Foo)->bar(); var_dump((new Foo)->bar()); var_dump((new Foo)->bar()); var_dump($r1, $r2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JLDOl
function name:  (null)
number of ops:  29
compiled vars:  !0 = $r1, !1 = $r2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $2, 'bar'
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !0, $4
   14     5        NEW                                              $6      'Foo'
          6        DO_FCALL                                      0          
          7        INIT_METHOD_CALL                                         $6, 'bar'
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !1, $8
   16    10        INIT_FCALL                                               'var_dump'
         11        NEW                                              $10     'Foo'
         12        DO_FCALL                                      0          
         13        INIT_METHOD_CALL                                         $10, 'bar'
         14        DO_FCALL                                      0  $12     
         15        SEND_VAR                                                 $12
         16        DO_ICALL                                                 
   17    17        INIT_FCALL                                               'var_dump'
         18        NEW                                              $14     'Foo'
         19        DO_FCALL                                      0          
         20        INIT_METHOD_CALL                                         $14, 'bar'
         21        DO_FCALL                                      0  $16     
         22        SEND_VAR                                                 $16
         23        DO_ICALL                                                 
   18    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JLDOl
function name:  bar
number of ops:  10
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                              !0
    8     1        JMP_SET                                          ~1      !0, ->8
          2        NEW                                              $2      'ReflectionClass'
          3        GET_CLASS                                        ~3      
          4        SEND_VAL_EX                                              ~3
          5        DO_FCALL                                      0          
          6        ASSIGN                                           ~5      !0, $2
          7        QM_ASSIGN                                        ~1      ~5
          8      > RETURN                                                   ~1
    9     9*     > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.46 ms | 1396 KiB | 15 Q