3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Randoz{ public function between0And10():int { return rand(0,10); } } interface RndCounter { function randomInt():int; function between0And10():int; } function create(): RndCounter { return new class() implements RndCounter { use Randoz; function randomInt():int { return rand(); } }; } $counter = create(); echo $counter->randomInt()." - ".$counter->between0And10();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gDrME
function name:  (null)
number of ops:  11
compiled vars:  !0 = $counter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'create'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   37     3        INIT_METHOD_CALL                                         !0, 'randomInt'
          4        DO_FCALL                                      0  $3      
          5        CONCAT                                           ~4      $3, '+-+'
          6        INIT_METHOD_CALL                                         !0, 'between0And10'
          7        DO_FCALL                                      0  $5      
          8        CONCAT                                           ~6      ~4, $5
          9        ECHO                                                     ~6
         10      > RETURN                                                   1

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gDrME
function name:  create
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $1      $0
          2        DO_FCALL                                      0          
          3        VERIFY_RETURN_TYPE                                       $1
          4      > RETURN                                                   $1
   32     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function create

Class Randoz:
Function between0and10:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gDrME
function name:  between0And10
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'rand'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $0      
          4        VERIFY_RETURN_TYPE                                       $0
          5      > RETURN                                                   $0
    8     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function between0and10

End of class Randoz.

Class RndCounter:
Function randomint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gDrME
function name:  randomInt
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function randomint

Function between0and10:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gDrME
function name:  between0And10
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function between0and10

End of class RndCounter.

Class RndCounter@anonymous:
Function randomint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gDrME
function name:  randomInt
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'rand'
          1        DO_ICALL                                         $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   29     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function randomint

End of class RndCounter@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
33.75 ms | 416 KiB | 7 Q