3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{ } function staticize( &$main_object = NULL ){ static $static_object = NULL; if( $main_object ) $static_object = $main_object; return $static_object; } $a = staticize( new Test ); var_dump( $a ); $b = staticize( new Test ); var_dump( $b );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JPWYe
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'staticize'
          1        NEW                                              $2      'Test'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF                               0          $2
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
   17     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   19     9        INIT_FCALL                                               'staticize'
         10        NEW                                              $7      'Test'
         11        DO_FCALL                                      0          
         12        SEND_VAR_NO_REF                               0          $7
         13        DO_FCALL                                      0  $9      
         14        ASSIGN                                                   !1, $9
   20    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function staticize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/JPWYe
function name:  staticize
number of ops:  6
compiled vars:  !0 = $main_object, !1 = $static_object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      null
    8     1        BIND_STATIC                                              !1
   10     2      > JMPZ                                                     !0, ->4
   11     3    >   ASSIGN                                                   !1, !0
   13     4    > > RETURN                                                   !1
   14     5*     > RETURN                                                   null

End of function staticize

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160 ms | 1398 KiB | 17 Q