3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Something { public function one(): int { global $number; if ($number === null) $number = 1; return $number; } public function two(): int { global $number; if ($number === null) $number = 2; return $number; } } $s = new Something(); var_dump($s->one()); var_dump($s->two());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sLt1g
function name:  (null)
number of ops:  14
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Something'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'one'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   21     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'two'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Something:
Function one:
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/sLt1g
function name:  one
number of ops:  8
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'number'
    8     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->4
          3    >   ASSIGN                                                   !0, 1
    9     4    >   VERIFY_RETURN_TYPE                                       !0
          5      > RETURN                                                   !0
   10     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function one

Function two:
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/sLt1g
function name:  two
number of ops:  8
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   BIND_GLOBAL                                              !0, 'number'
   14     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->4
          3    >   ASSIGN                                                   !0, 2
   15     4    >   VERIFY_RETURN_TYPE                                       !0
          5      > RETURN                                                   !0
   16     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function two

End of class Something.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.04 ms | 1396 KiB | 15 Q