svn: /phpdoc/ja/trunk/language/ variables.xml

From: Date: Sun, 03 May 2020 10:23:10 +0000
Subject: svn: /phpdoc/ja/trunk/language/ variables.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-5621@lists.php.net to get a copy of this message
mumumu Sun, 03 May 2020 10:23:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=349738 Log: Update examples for PHP 5+ Changed paths: U phpdoc/ja/trunk/language/variables.xml Modified: phpdoc/ja/trunk/language/variables.xml =================================================================== --- phpdoc/ja/trunk/language/variables.xml 2020-05-03 10:17:33 UTC (rev 349737) +++ phpdoc/ja/trunk/language/variables.xml 2020-05-03 10:23:10 UTC (rev 349738) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 347269 Maintainer: takagi Status: ready --> +<!-- EN-Revision: 349734 Maintainer: takagi Status: ready --> <!-- CREDITS: hirokawa,mumumu --> <chapter xml:id="language.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>変数</title> @@ -522,12 +522,14 @@ <?php function test_global_ref() { global $obj; - $obj = &new stdclass; + $new = new stdclass; + $obj = &$new; } function test_global_noref() { global $obj; - $obj = new stdclass; + $new = new stdclass; + $obj = $new; } test_global_ref(); @@ -542,9 +544,11 @@ &example.outputs; <screen> +<![CDATA[ NULL -object(stdClass)(0) { +object(stdClass)#1 (0) { } +]]> </screen> <simpara> @@ -562,10 +566,15 @@ echo 'Static object: '; var_dump($obj); if (!isset($obj)) { + $new = new stdclass; // Assign a reference to the static variable - $obj = &new stdclass; + $obj = &$new; } - $obj->property++; + if (!isset($obj->property)) { + $obj->property = 1; + } else { + $obj->property++; + } return $obj; } @@ -575,10 +584,15 @@ echo 'Static object: '; var_dump($obj); if (!isset($obj)) { + $new = new stdclass; // Assign the object to the static variable - $obj = new stdclass; + $obj = $new; } - $obj->property++; + if (!isset($obj->property)) { + $obj->property = 1; + } else { + $obj->property++; + } return $obj; } @@ -597,14 +611,16 @@ </simpara> <screen> +<![CDATA[ Static object: NULL Static object: NULL Static object: NULL -Static object: object(stdClass)(1) { +Static object: object(stdClass)#3 (1) { ["property"]=> int(1) } ++]]> </screen> <simpara>

« previous php.doc.ja (#5621) next »