3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbstractClass { public function __construct() { echo 'aaa'; } // Our abstract method only needs to define the required arguments abstract protected function prefixName($name); } class ConcreteClass extends AbstractClass { public function __construct($a) { echo $a; } // Our child class may define optional arguments not in the parent's signature public function prefixName($name, $separator=0 ) { if ($name == "Pacman") { $prefix = "Mr"; } elseif ($name == "Pacwoman") { $prefix = "Mrs"; } else { $prefix = ""; } return "{$prefix}{$separator} {$name}"; } } $class = new ConcreteClass; echo $class->prefixName("Pacman"), "\n"; echo $class->prefixName("Pacwoman"), "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6l60
function name:  (null)
number of ops:  14
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $1      'ConcreteClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   32     3        INIT_METHOD_CALL                                         !0, 'prefixName'
          4        SEND_VAL_EX                                              'Pacman'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7        ECHO                                                     '%0A'
   33     8        INIT_METHOD_CALL                                         !0, 'prefixName'
          9        SEND_VAL_EX                                              'Pacwoman'
         10        DO_FCALL                                      0  $5      
         11        ECHO                                                     $5
         12        ECHO                                                     '%0A'
   34    13      > RETURN                                                   1

Class AbstractClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6l60
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'aaa'
    6     1      > RETURN                                                   null

End of function __construct

Function prefixname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6l60
function name:  prefixName
number of ops:  2
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function prefixname

End of class AbstractClass.

Class ConcreteClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6l60
function name:  __construct
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        ECHO                                                     !0
   17     2      > RETURN                                                   null

End of function __construct

Function prefixname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6l60
function name:  prefixName
number of ops:  17
compiled vars:  !0 = $name, !1 = $separator, !2 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
   20     2        IS_EQUAL                                                 !0, 'Pacman'
          3      > JMPZ                                                     ~3, ->6
   21     4    >   ASSIGN                                                   !2, 'Mr'
          5      > JMP                                                      ->11
   22     6    >   IS_EQUAL                                                 !0, 'Pacwoman'
          7      > JMPZ                                                     ~5, ->10
   23     8    >   ASSIGN                                                   !2, 'Mrs'
          9      > JMP                                                      ->11
   25    10    >   ASSIGN                                                   !2, ''
   27    11    >   ROPE_INIT                                     4  ~9      !2
         12        ROPE_ADD                                      1  ~9      ~9, !1
         13        ROPE_ADD                                      2  ~9      ~9, '+'
         14        ROPE_END                                      3  ~8      ~9, !0
         15      > RETURN                                                   ~8
   28    16*     > RETURN                                                   null

End of function prefixname

End of class ConcreteClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.31 ms | 1390 KiB | 13 Q