3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Declara a interface 'iTemplate' interface iTemplate { public function setVariable($name, $var); public function getHtml($template); } // Implementa a interface // Isso funcionará class Template implements iTemplate { private $vars = array(); public function setVariable($name, $var) { $this->vars[$name] = $var; } public function getHtml($template) { echo 'tchau'; } } // Isso NÃO funcionará // Fatal error: Class BadTemplate contains 1 abstract methods // and must therefore be declared abstract (iTemplate::getHtml) class BadTemplate extends Template { private $vars = array('x' => 'o'); public function getHtml($template) { echo 'oi'; } } $o = new BadTemplate(); $o->getHtml("aa {x} "); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EkEE1
function name:  (null)
number of ops:  9
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'template'
   31     1        DECLARE_CLASS                                            'badtemplate', 'template'
   41     2        NEW                                              $1      'BadTemplate'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   42     5        INIT_METHOD_CALL                                         !0, 'getHtml'
          6        SEND_VAL_EX                                              'aa+%7Bx%7D+'
          7        DO_FCALL                                      0          
   44     8      > RETURN                                                   1

Class iTemplate:
Function setvariable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EkEE1
function name:  setVariable
number of ops:  3
compiled vars:  !0 = $name, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function setvariable

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

End of function gethtml

End of class iTemplate.

Class Template:
Function setvariable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EkEE1
function name:  setVariable
number of ops:  6
compiled vars:  !0 = $name, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        FETCH_OBJ_W                                      $2      'vars'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   19     5      > RETURN                                                   null

End of function setvariable

Function gethtml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EkEE1
function name:  getHtml
number of ops:  3
compiled vars:  !0 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ECHO                                                     'tchau'
   23     2      > RETURN                                                   null

End of function gethtml

End of class Template.

Class BadTemplate:
Function gethtml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EkEE1
function name:  getHtml
number of ops:  3
compiled vars:  !0 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   37     1        ECHO                                                     'oi'
   38     2      > RETURN                                                   null

End of function gethtml

End of class BadTemplate.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.4 ms | 1390 KiB | 13 Q