mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Adding a note about HTTP_POST_VARS being deprecated to variables.scope, and making quotes consistent
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@177633 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9b1974f6e9
commit
445c2b8a7a
1 changed files with 14 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.84 $ -->
|
||||
<!-- $Revision: 1.85 $ -->
|
||||
<chapter id="language.variables">
|
||||
<title>Variables</title>
|
||||
|
||||
|
@ -36,8 +36,8 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$var = "Bob";
|
||||
$Var = "Joe";
|
||||
$var = 'Bob';
|
||||
$Var = 'Joe';
|
||||
echo "$var, $Var"; // outputs "Bob, Joe"
|
||||
|
||||
$4site = 'not yet'; // invalid; starts with a number
|
||||
|
@ -335,7 +335,7 @@ $bar = &test(); // Invalid.
|
|||
<![CDATA[
|
||||
<?php
|
||||
$a = 1;
|
||||
include "b.inc";
|
||||
include 'b.inc';
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -431,7 +431,7 @@ $b = 2;
|
|||
|
||||
function Sum()
|
||||
{
|
||||
$GLOBALS["b"] = $GLOBALS["a"] + $GLOBALS["b"];
|
||||
$GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b'];
|
||||
}
|
||||
|
||||
Sum();
|
||||
|
@ -467,7 +467,8 @@ function test_global()
|
|||
|
||||
// Superglobals are available in any scope and do
|
||||
// not require 'global'. Superglobals are available
|
||||
// as of PHP 4.1.0
|
||||
// as of PHP 4.1.0, and HTTP_POST_VARS is now
|
||||
// deemed deprecated.
|
||||
echo $_POST['name'];
|
||||
}
|
||||
?>
|
||||
|
@ -652,7 +653,7 @@ object(stdClass)(0) {
|
|||
function &get_instance_ref() {
|
||||
static $obj;
|
||||
|
||||
echo "Static object: ";
|
||||
echo 'Static object: ';
|
||||
var_dump($obj);
|
||||
if (!isset($obj)) {
|
||||
// Assign a reference to the static variable
|
||||
|
@ -665,7 +666,7 @@ function &get_instance_ref() {
|
|||
function &get_instance_noref() {
|
||||
static $obj;
|
||||
|
||||
echo "Static object: ";
|
||||
echo 'Static object: ';
|
||||
var_dump($obj);
|
||||
if (!isset($obj)) {
|
||||
// Assign the object to the static variable
|
||||
|
@ -721,7 +722,7 @@ Static object: object(stdClass)(1) {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$a = "hello";
|
||||
$a = 'hello';
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -738,7 +739,7 @@ $a = "hello";
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$$a = "world";
|
||||
$$a = 'world';
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -1004,8 +1005,8 @@ if (isset($_POST['action']) && $_POST['action'] == 'submitted') {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
setcookie("MyCookie[foo]", "Testing 1", time()+3600);
|
||||
setcookie("MyCookie[bar]", "Testing 2", time()+3600);
|
||||
setcookie("MyCookie[foo]", 'Testing 1', time()+3600);
|
||||
setcookie("MyCookie[bar]", 'Testing 2', time()+3600);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -1035,7 +1036,7 @@ if (isset($_COOKIE['count'])) {
|
|||
} else {
|
||||
$count = 1;
|
||||
}
|
||||
setcookie("count", $count, time()+3600);
|
||||
setcookie('count', $count, time()+3600);
|
||||
setcookie("Cart[$count]", $item, time()+3600);
|
||||
?>
|
||||
]]>
|
||||
|
|
Loading…
Reference in a new issue