3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Aircraft { /** * @var string */ private $aircraftType; /** * @var string */ private $departureCity; /** * @var string */ private $arrivalCity; public function __construct( string $aircraftType, string $departureCity, string $arrivalCity ) { $this->aircraftType = $aircraftType; $this->departureCity = $departureCity; $this->arrivalCity = $arrivalCity; } public function __toString(): string { return sprintf( "Bienvenue à bord de notre %s.\n" . "Ce vol est en décollage imminent de %s et aura pour arrivée %s.", $this->aircraftType(), $this->departureCity(), $this->arrivalCity() ); } public function aircraftType(): string { return $this->aircraftType; } public function departureCity(): string { return $this->departureCity; } public function arrivalCity(): string { return $this->arrivalCity; } } class LowCostAircraft extends Aircraft { public function __construct( string $aircraftType, string $departureCity, string $arrivalCity ) { parent::__construct($aircraftType, $departureCity, $arrivalCity); } public function arrivalCity(): string { return sprintf("%s.\nLe moteur est le coeur d'un avion, mais le pilote est son âme", parent::arrivalCity()); } } echo new LowCostAircraft('easyJet', 'Nice', 'Mulhouse');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'aircraft'
   55     1        DECLARE_CLASS                                            'lowcostaircraft', 'aircraft'
   71     2        NEW                                              $0      'LowCostAircraft'
          3        SEND_VAL_EX                                              'easyJet'
          4        SEND_VAL_EX                                              'Nice'
          5        SEND_VAL_EX                                              'Mulhouse'
          6        DO_FCALL                                      0          
          7        ECHO                                                     $0
          8      > RETURN                                                   1

Class Aircraft:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  __construct
number of ops:  10
compiled vars:  !0 = $aircraftType, !1 = $departureCity, !2 = $arrivalCity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   23     3        ASSIGN_OBJ                                               'aircraftType'
          4        OP_DATA                                                  !0
   24     5        ASSIGN_OBJ                                               'departureCity'
          6        OP_DATA                                                  !1
   25     7        ASSIGN_OBJ                                               'arrivalCity'
          8        OP_DATA                                                  !2
   26     9      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  __toString
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_FCALL                                               'sprintf'
   32     1        SEND_VAL                                                 'Bienvenue+%C3%A0+bord+de+notre+%25s.%0ACe+vol+est+en+d%C3%A9collage+imminent+de+%25s+et+aura+pour+arriv%C3%A9e+%25s.'
   33     2        INIT_METHOD_CALL                                         'aircraftType'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
   34     5        INIT_METHOD_CALL                                         'departureCity'
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
   35     8        INIT_METHOD_CALL                                         'arrivalCity'
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                         $3      
         12        VERIFY_RETURN_TYPE                                       $3
         13      > RETURN                                                   $3
   37    14*       VERIFY_RETURN_TYPE                                       
         15*     > RETURN                                                   null

End of function __tostring

Function aircrafttype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  aircraftType
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   FETCH_OBJ_R                                      ~0      'aircraftType'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   42     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function aircrafttype

Function departurecity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  departureCity
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   FETCH_OBJ_R                                      ~0      'departureCity'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   47     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function departurecity

Function arrivalcity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  arrivalCity
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   FETCH_OBJ_R                                      ~0      'arrivalCity'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   52     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function arrivalcity

End of class Aircraft.

Class LowCostAircraft:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  __construct
number of ops:  9
compiled vars:  !0 = $aircraftType, !1 = $departureCity, !2 = $arrivalCity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   62     3        INIT_STATIC_METHOD_CALL                                  
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !1
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0          
   63     8      > RETURN                                                   null

End of function __construct

Function arrivalcity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECneC
function name:  arrivalCity
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   INIT_FCALL                                               'sprintf'
          1        SEND_VAL                                                 '%25s.%0ALe+moteur+est+le+coeur+d%27un+avion%2C+mais+le+pilote+est+son+%C3%A2me'
          2        INIT_STATIC_METHOD_CALL                                  'arrivalCity'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                         $1      
          6        VERIFY_RETURN_TYPE                                       $1
          7      > RETURN                                                   $1
   68     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function arrivalcity

End of class LowCostAircraft.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.09 ms | 1404 KiB | 15 Q