📄 migration51.reading.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Reading []</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration51.references.html">Changes in reference handling</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration51.integer-parameters.html">Integer values in function parameters</a></div> <div class="up"><a href="migration51.html">Migrating from PHP 5.0.x to PHP 5.1.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="migration51.reading" class="section"> <h2 class="title">Reading []</h2> <div class="informalexample"> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">XmlTest </span><span style="color: #007700">{<br /><br /> function </span><span style="color: #0000BB">test_ref</span><span style="color: #007700">(&</span><span style="color: #0000BB">$test</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$test </span><span style="color: #007700">= </span><span style="color: #DD0000">"ok"</span><span style="color: #007700">;<br /> }<br /><br /> function </span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">$test</span><span style="color: #007700">) { }<br /><br /> function </span><span style="color: #0000BB">run</span><span style="color: #007700">() {<br /> </span><span style="color: #0000BB">$ar </span><span style="color: #007700">= array();<br /> </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">test_ref</span><span style="color: #007700">(</span><span style="color: #0000BB">$ar</span><span style="color: #007700">[]);<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$ar</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">$ar</span><span style="color: #007700">[]);<br /> }<br />}<br /><br /></span><span style="color: #0000BB">$o </span><span style="color: #007700">= new </span><span style="color: #0000BB">XmlTest</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$o</span><span style="color: #007700">-></span><span style="color: #0000BB">run</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> <p class="para"> This should always have thrown a fatal <b><tt>E_ERROR</tt></b>, because [] cannot be used for reading in PHP. It is invalid code in PHP 4.4.2 and PHP 5.0.5 upward. </p> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration51.references.html">Changes in reference handling</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration51.integer-parameters.html">Integer values in function parameters</a></div> <div class="up"><a href="migration51.html">Migrating from PHP 5.0.x to PHP 5.1.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -