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) { } public function getHtml($template) { } } // Isso NÃO funcionará // Fatal error: Class BadTemplate contains 1 abstract methods // and must therefore be declared abstract (iTemplate::getHtml) class BadTemplate extends Template implements iTemplate { 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/38eoO
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'
   26     1        DECLARE_CLASS                                            'badtemplate', 'template'
   36     2        NEW                                              $1      'BadTemplate'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   37     5        INIT_METHOD_CALL                                         !0, 'getHtml'
          6        SEND_VAL_EX                                              'aa+%7Bx%7D+'
          7        DO_FCALL                                      0          
   39     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/38eoO
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/38eoO
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/38eoO
function name:  setVariable
number of ops:  3
compiled vars:  !0 = $name, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     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/38eoO
function name:  getHtml
number of ops:  2
compiled vars:  !0 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1      > 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/38eoO
function name:  getHtml
number of ops:  3
compiled vars:  !0 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   32     1        ECHO                                                     'oi'
   33     2      > RETURN                                                   null

End of function gethtml

End of class BadTemplate.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.62 ms | 1399 KiB | 13 Q