-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreading.html
70 lines (55 loc) · 4.61 KB
/
reading.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Reading [] in PHP 5.1</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Lito && Óscar Otero">
<meta name="title" content="Reading [] in PHP 5.1">
<meta property="og:type" content="website">
<meta property="og:url" content="https://eusonlito.github.io/php-changes-cheatsheet">
<meta property="og:title" content="Reading [] in PHP 5.1">
<meta property="og:image" content="./images/social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://eusonlito.github.io/php-changes-cheatsheet">
<meta name="twitter:site" content="@lito_ordes">
<meta name="twitter:creator" content="@lito_ordes">
<meta name="twitter:title" content="Reading [] in PHP 5.1">
<meta name="twitter:image" content="./images/social.png">
<link href="//fonts.googleapis.com/css?family=Fira+Sans|Droid+Sans|Source+Sans+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="./phpnet.css?1744308666" type="text/css" media="screen">
<link rel="stylesheet" href="./styles.css?1744308666" type="text/css" media="screen">
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<meta name="theme-color" content="#ffffff">
</head>
<body class="docs">
<section class="info-wrapper">
<nav id="head-nav" class="navbar">
<h1><a href="index.html"> Reading [] in PHP 5.1</a></h1>
</nav>
<main class="info-main">
<article id="layout-content" class="info-version">
<header class="info-version-header">
<h1><a href="https://www.php.net/manual/en/migration51.reading.php" target="_blank">PHP 5.1</a></h1>
</header>
<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 <strong><code>E_ERROR</code></strong>,
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></article> </main>
</section> </body>
</html>