Internals2/opcodes/declare-inherited-class-Phpdoc专题

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 fetch ext return operands
6 0 JMPZ       !0,->5
7 1 ZEND_DECLARE_CLASS     $0 '%00foo%2Fmnt%2Fworkspace%2Fws_phpscripts%2FPHPopcodes%2Fphpsamples%2FDECLARE_INHERITED_CLASS.php0xb7be503b','foo'
14 2 ZEND_FETCH_CLASS     :1 'Foo'
  3 ZEND_DECLARE_INHERITED_CLASS     $2 '%00bar%2Fmnt%2Fworkspace%2Fws_phpscripts%2FPHPopcodes%2Fphpsamples%2FDECLARE_INHERITED_CLASS.php0xb7be50bc','bar'
19 4 JMP       ->5
20 5 RETURN       1

Function name: staticValue

Compiled variables: !0=$my_static

line # op fetch ext return operands
10 0 ZEND_FETCH_CLASS        
  1 FETCH_R staticmember   $1 'my_static'
  2 RETURN       $1
11 3 RETURN       null

Function name: fooStatic

Compiled variables: !0=$my_static

line # op fetch ext return operands
16 0 ZEND_FETCH_CLASS     :0  
  1 FETCH_R staticmember   $1 'my_static'
  2 ECHO       $1
17 3 RETURN       null

本站为非盈利网站,作品由网友提供上传,如无意中有侵犯您的版权,请联系删除