3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Math { const pi = 3.14; } class CircleMath extends Math { public static function calculateArea($radius) { return parent::pi * pow($radius, 2); } } class Circle { private $radius; private $color; private $coordinates; public function __construct() { $numArgs = func_num_args(); $this->radius = $numArgs > 0 ? func_get_arg(0) : 1.0; $this->color = $numArgs > 1 ? func_get_arg(1) : 'blue'; $this->coordinates = $numArgs > 2 ? func_get_arg(2) : array('x' => 1, 'y' => 1); } public function calculateArea() { return CircleMath::calculateArea($this->radius); } public function get_radius() { return $this->radius; } public function get_color() { return $this->color; } public function get_coordinates() { return $this->coordinates; } } $className = 'Circle'; $circle = new $className(); print sprintf('The area of %s circle with radius %s and center positioned in (%s, %s) is: %s', $circle->get_color(), $circle->get_radius(), $circle->get_coordinates()['x'], $circle->get_coordinates()['y'], $circle->calculateArea()); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8psl5
function name:  (null)
number of ops:  27
compiled vars:  !0 = $className, !1 = $circle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   ASSIGN                                                   !0, 'Circle'
   45     1        FETCH_CLASS                                   0  $3      !0
          2        NEW                                              $4      $3
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   47     5        INIT_FCALL                                               'sprintf'
          6        SEND_VAL                                                 'The+area+of+%25s+circle+with+radius+%25s+and+center+positioned+in+%28%25s%2C+%25s%29+is%3A+%25s'
   48     7        INIT_METHOD_CALL                                         !1, 'get_color'
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR                                                 $7
         10        INIT_METHOD_CALL                                         !1, 'get_radius'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        INIT_METHOD_CALL                                         !1, 'get_coordinates'
         14        DO_FCALL                                      0  $9      
         15        FETCH_DIM_R                                      ~10     $9, 'x'
         16        SEND_VAL                                                 ~10
   49    17        INIT_METHOD_CALL                                         !1, 'get_coordinates'
         18        DO_FCALL                                      0  $11     
         19        FETCH_DIM_R                                      ~12     $11, 'y'
         20        SEND_VAL                                                 ~12
         21        INIT_METHOD_CALL                                         !1, 'calculateArea'
         22        DO_FCALL                                      0  $13     
         23        SEND_VAR                                                 $13
         24        DO_ICALL                                         $14     
         25        ECHO                                                     $14
   51    26      > RETURN                                                   1

Class Math: [no user functions]
Class CircleMath:
Function calculatearea:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8psl5
function name:  calculateArea
number of ops:  9
compiled vars:  !0 = $radius
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_CLASS_CONSTANT                             ~1      'pi'
          2        INIT_FCALL                                               'pow'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 2
          5        DO_ICALL                                         $2      
          6        MUL                                              ~3      $2, ~1
          7      > RETURN                                                   ~3
   10     8*     > RETURN                                                   null

End of function calculatearea

End of class CircleMath.

Class Circle:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
Branch analysis from position: 29
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
Branch analysis from position: 19
filename:       /in/8psl5
function name:  __construct
number of ops:  33
compiled vars:  !0 = $numArgs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FUNC_NUM_ARGS                                    ~1      
          1        ASSIGN                                                   !0, ~1
   21     2        IS_SMALLER                                               0, !0
          3      > JMPZ                                                     ~4, ->9
          4    >   INIT_FCALL                                               'func_get_arg'
          5        SEND_VAL                                                 0
          6        DO_ICALL                                         $5      
          7        QM_ASSIGN                                        ~6      $5
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~6      1
         10    >   ASSIGN_OBJ                                               'radius'
         11        OP_DATA                                                  ~6
   22    12        IS_SMALLER                                               1, !0
         13      > JMPZ                                                     ~8, ->19
         14    >   INIT_FCALL                                               'func_get_arg'
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $9      
         17        QM_ASSIGN                                        ~10     $9
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~10     'blue'
         20    >   ASSIGN_OBJ                                               'color'
         21        OP_DATA                                                  ~10
   23    22        IS_SMALLER                                               2, !0
         23      > JMPZ                                                     ~12, ->29
         24    >   INIT_FCALL                                               'func_get_arg'
         25        SEND_VAL                                                 2
         26        DO_ICALL                                         $13     
         27        QM_ASSIGN                                        ~14     $13
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~14     <array>
         30    >   ASSIGN_OBJ                                               'coordinates'
         31        OP_DATA                                                  ~14
   24    32      > RETURN                                                   null

End of function __construct

Function calculatearea:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8psl5
function name:  calculateArea
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                  'CircleMath', 'calculateArea'
          1        FETCH_OBJ_R                                      ~0      'radius'
          2        SEND_VAL                                                 ~0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   28     5*     > RETURN                                                   null

End of function calculatearea

Function get_radius:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8psl5
function name:  get_radius
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'radius'
          1      > RETURN                                                   ~0
   32     2*     > RETURN                                                   null

End of function get_radius

Function get_color:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8psl5
function name:  get_color
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                      ~0      'color'
          1      > RETURN                                                   ~0
   36     2*     > RETURN                                                   null

End of function get_color

Function get_coordinates:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8psl5
function name:  get_coordinates
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   FETCH_OBJ_R                                      ~0      'coordinates'
          1      > RETURN                                                   ~0
   40     2*     > RETURN                                                   null

End of function get_coordinates

End of class Circle.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.41 ms | 1404 KiB | 19 Q