3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Math { const pi = 3.14; } class CircleMath extends Math { public static function calculateArea($radio) { return parent::pi * pow($radio, 2); } } class Circle { private $radio; private $color; private $coordinates; public function __construct($radio, $color = 'blue', $coordinates = array('x' => 0, 'y' => 0)) { $this->radio = $radio; $this->color = $color; $this->coordinates = $coordinates; } public function calculateArea() { return CircleMath::calculateArea($this->radio); } public function get_radio() { return $this->radio; } public function get_color() { return $this->color; } public function get_coordinates() { return $this->coordinates; } } $className = 'Circle'; $circle = new $className(5); echo sprintf('The area of %s circle with radio %s and center positioned in (%s, %s) is: %s', $circle->get_color(), $circle->get_radio(), $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/de40B
function name:  (null)
number of ops:  28
compiled vars:  !0 = $className, !1 = $circle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   ASSIGN                                                   !0, 'Circle'
   43     1        FETCH_CLASS                                   0  $3      !0
          2        NEW                                              $4      $3
          3        SEND_VAL_EX                                              5
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   45     6        INIT_FCALL                                               'sprintf'
          7        SEND_VAL                                                 'The+area+of+%25s+circle+with+radio+%25s+and+center+positioned+in+%28%25s%2C+%25s%29+is%3A+%25s'
   46     8        INIT_METHOD_CALL                                         !1, 'get_color'
          9        DO_FCALL                                      0  $7      
         10        SEND_VAR                                                 $7
         11        INIT_METHOD_CALL                                         !1, 'get_radio'
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        INIT_METHOD_CALL                                         !1, 'get_coordinates'
         15        DO_FCALL                                      0  $9      
         16        FETCH_DIM_R                                      ~10     $9, 'x'
         17        SEND_VAL                                                 ~10
   47    18        INIT_METHOD_CALL                                         !1, 'get_coordinates'
         19        DO_FCALL                                      0  $11     
         20        FETCH_DIM_R                                      ~12     $11, 'y'
         21        SEND_VAL                                                 ~12
         22        INIT_METHOD_CALL                                         !1, 'calculateArea'
         23        DO_FCALL                                      0  $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                         $14     
         26        ECHO                                                     $14
   49    27      > 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/de40B
function name:  calculateArea
number of ops:  9
compiled vars:  !0 = $radio
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/de40B
function name:  __construct
number of ops:  10
compiled vars:  !0 = $radio, !1 = $color, !2 = $coordinates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'blue'
          2        RECV_INIT                                        !2      <array>
   19     3        ASSIGN_OBJ                                               'radio'
          4        OP_DATA                                                  !0
   20     5        ASSIGN_OBJ                                               'color'
          6        OP_DATA                                                  !1
   21     7        ASSIGN_OBJ                                               'coordinates'
          8        OP_DATA                                                  !2
   22     9      > 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/de40B
function name:  calculateArea
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_STATIC_METHOD_CALL                                  'CircleMath', 'calculateArea'
          1        FETCH_OBJ_R                                      ~0      'radio'
          2        SEND_VAL                                                 ~0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   26     5*     > RETURN                                                   null

End of function calculatearea

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

End of function get_radio

Function get_color:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/de40B
function name:  get_color
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   FETCH_OBJ_R                                      ~0      'color'
          1      > RETURN                                                   ~0
   34     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/de40B
function name:  get_coordinates
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~0      'coordinates'
          1      > RETURN                                                   ~0
   38     2*     > RETURN                                                   null

End of function get_coordinates

End of class Circle.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.21 ms | 1396 KiB | 17 Q