Doc #80651 [Opn->Csd]: [ZH] Example #1 chinese language
Edit report at https://bugs.php.net/bug.php?id=80651&edit=1
ID: 80651
Updated by: jhdxr@php.net
Reported by: super at rongsp dot com
Summary: [ZH] Example #1 chinese language
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Translation problem
Operating System: windows10
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of jhdxr
Revision: http://git.php.net/?p=doc/zh.git;a=commit;h=abd61b44f3ed40f4f840a70a2abe2af9ef6209fe
Log: sync with en. fix #80651
Previous Comments:
------------------------------------------------------------------------
[2021-01-21 03:30:03] super at rongsp dot com
Description:
------------
---
From manual page: https://php.net/language.oop5.static
---
From https://www.php.net/manual/zh/language.oop5.static.php
<?php
class Foo
{
public static $my_static = 'foo';
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
print Foo::$my_static . "\n";
$foo = new Foo();
print $foo->staticValue() . "\n";
print $foo->my_static . "\n"; // Undefined "Property" my_static
print $foo::$my_static . "\n";
$classname = 'Foo';
print $classname::$my_static . "\n"; // As of PHP 5.3.0
print Bar::$my_static . "\n";
$bar = new Bar();
print $bar->fooStatic() . "\n";
?>
</programlisting>
</example>
<example>
<title>éææ¹æ³ç¤ºä¾</title>
<programlisting role="php">
<![CDATA[
<?php
class Foo {
public static function aStaticMethod() {
// ...
}
}
Foo::aStaticMethod();
$classname = 'Foo';
$classname::aStaticMethod(); // èª PHP 5.3.0 èµ·
?>
--------------------------
</programlisting>
</example>
<example>
<title>éææ¹æ³ç¤ºä¾</title>
<programlisting role="php">
<![CDATA[
--------------------------
Test script:
---------------
<?php
class Foo
{
public static $my_static = 'foo';
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
print Foo::$my_static . "\n";
$foo = new Foo();
print $foo->staticValue() . "\n";
print $foo->my_static . "\n"; // Undefined "Property" my_static
print $foo::$my_static . "\n";
$classname = 'Foo';
print $classname::$my_static . "\n"; // As of PHP 5.3.0
print Bar::$my_static . "\n";
$bar = new Bar();
print $bar->fooStatic() . "\n";
?>
<?php
class Foo {
public static function aStaticMethod() {
// ...
}
}
Foo::aStaticMethod();
$classname = 'Foo';
$classname::aStaticMethod(); // èª PHP 5.3.0 èµ·
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80651&edit=1
Thread (2 messages)