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() { echo func_get_arg(0); echo func_get_arg(1); echo func_get_arg(2); $this->radius = func_get_arg(0) || 1.0; $this->color = func_get_arg(1) || 'blue'; $this->coordinates = 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/PdnLr
function name:  (null)
number of ops:  27
compiled vars:  !0 = $className, !1 = $circle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   ASSIGN                                                   !0, 'Circle'
   47     1        FETCH_CLASS                                   0  $3      !0
          2        NEW                                              $4      $3
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   49     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'
   50     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
   51    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
   53    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/PdnLr
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 = 47) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
2 jumps found. (Code = 47) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 24
Branch analysis from position: 17
filename:       /in/PdnLr
function name:  __construct
number of ops:  34
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'func_get_arg'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                         $0      
          3        ECHO                                                     $0
   20     4        INIT_FCALL                                               'func_get_arg'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $1      
          7        ECHO                                                     $1
   21     8        INIT_FCALL                                               'func_get_arg'
          9        SEND_VAL                                                 2
         10        DO_ICALL                                         $2      
         11        ECHO                                                     $2
   23    12        INIT_FCALL                                               'func_get_arg'
         13        SEND_VAL                                                 0
         14        DO_ICALL                                         $4      
         15      > JMPNZ_EX                                         ~5      $4, ->17
         16    >   BOOL                                             ~5      1
         17    >   ASSIGN_OBJ                                               'radius'
         18        OP_DATA                                                  ~5
   24    19        INIT_FCALL                                               'func_get_arg'
         20        SEND_VAL                                                 1
         21        DO_ICALL                                         $7      
         22      > JMPNZ_EX                                         ~8      $7, ->24
         23    >   BOOL                                             ~8      'blue'
         24    >   ASSIGN_OBJ                                               'color'
         25        OP_DATA                                                  ~8
   25    26        INIT_FCALL                                               'func_get_arg'
         27        SEND_VAL                                                 2
         28        DO_ICALL                                         $10     
         29      > JMPNZ_EX                                         ~11     $10, ->31
         30    >   BOOL                                             ~11     <array>
         31    >   ASSIGN_OBJ                                               'coordinates'
         32        OP_DATA                                                  ~11
   26    33      > 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/PdnLr
function name:  calculateArea
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     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
   30     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/PdnLr
function name:  get_radius
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   FETCH_OBJ_R                                      ~0      'radius'
          1      > RETURN                                                   ~0
   34     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/PdnLr
function name:  get_color
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~0      'color'
          1      > RETURN                                                   ~0
   38     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/PdnLr
function name:  get_coordinates
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   FETCH_OBJ_R                                      ~0      'coordinates'
          1      > RETURN                                                   ~0
   42     2*     > RETURN                                                   null

End of function get_coordinates

End of class Circle.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.77 ms | 1404 KiB | 19 Q