3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { private static ? int $in = null; public static function in() : int { if (empty(self::$in)) { self::$in = rand(0,10); } return self::$in; } } class A { use T; } class B { use T; } var_dump(A::in(), B::in());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RvqXP
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                            'a'
   15     1        DECLARE_CLASS                                            'b'
   17     2        INIT_FCALL                                               'var_dump'
          3        INIT_STATIC_METHOD_CALL                                  'A', 'in'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        INIT_STATIC_METHOD_CALL                                  'B', 'in'
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class T:
Function in:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/RvqXP
function name:  in
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ISSET_ISEMPTY_STATIC_PROP                                'in'
          1      > JMPZ                                                     ~0, ->8
    7     2    >   INIT_FCALL                                               'rand'
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 10
          5        DO_ICALL                                         $2      
          6        ASSIGN_STATIC_PROP                                       'in'
          7        OP_DATA                                                  $2
    9     8    >   FETCH_STATIC_PROP_R          unknown             ~3      'in'
          9        VERIFY_RETURN_TYPE                                       ~3
         10      > RETURN                                                   ~3
   10    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function in

End of class T.

Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.49 ms | 1006 KiB | 15 Q