略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: DECLARE_INHERITED_CLASS

2024-12-26

DECLARE_INHERITED_CLASS

PHP code

<?php
/*
 * 
 * opcode number: 140
 */
 
if($b){
 class 
Foo {
  public static 
$my_static 'foo';
  public function 
staticValue() {
    return 
self::$my_static;
  }
 }

 class 
Bar extends Foo {
  public function 
fooStatic() {
     echo 
parent::$my_static;
  }
 }
}
?>

PHP opcodes

Function name: (null)

Compiled variables: !0=$b

line#op fetchextreturn operands
60 JMPZ     !0,->5
71 ZEND_DECLARE_CLASS   $0 '%00foo%2Fmnt%2Fworkspace%2Fws_phpscripts%2FPHPopcodes%2Fphpsamples%2FDECLARE_INHERITED_CLASS.php0xb7be503b','foo'
142 ZEND_FETCH_CLASS   :1 'Foo'
 3 ZEND_DECLARE_INHERITED_CLASS   $2 '%00bar%2Fmnt%2Fworkspace%2Fws_phpscripts%2FPHPopcodes%2Fphpsamples%2FDECLARE_INHERITED_CLASS.php0xb7be50bc','bar'
194 JMP     ->5
205 RETURN     1

Function name: staticValue

Compiled variables: !0=$my_static

line#op fetchextreturn operands
100 ZEND_FETCH_CLASS      
 1 FETCH_Rstaticmember  $1 'my_static'
 2 RETURN     $1
113 RETURN     null

Function name: fooStatic

Compiled variables: !0=$my_static

line#op fetchextreturn operands
160 ZEND_FETCH_CLASS   :0  
 1 FETCH_Rstaticmember  $1 'my_static'
 2 ECHO     $1
173 RETURN     null
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/internals2.opcodes.declare-inherited-class.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3