mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
More typos fixed
. object properties should start lowercased . some misspelled words, and bad examples corrected git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@55568 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
115607076a
commit
15a63ed54b
1 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.25 $ -->
|
||||
<!-- $Revision: 1.26 $ -->
|
||||
<chapter id="language.oop">
|
||||
<title>Classes and Objects</title>
|
||||
|
||||
|
@ -710,12 +710,12 @@ class Foo
|
|||
|
||||
function echoName()
|
||||
{
|
||||
echo "<br>",$this->Name;
|
||||
echo "<br>",$this->name;
|
||||
}
|
||||
|
||||
function setName($name)
|
||||
{
|
||||
$this->Name = $name;
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
</programlisting>
|
||||
|
@ -741,7 +741,7 @@ set in constructor
|
|||
set in constructor
|
||||
set in constructor */
|
||||
|
||||
$bar2 =& new foo('set in constructor');
|
||||
$bar2 =& new Foo('set in constructor');
|
||||
$bar2->echoName();
|
||||
$globalref[1]->echoName();
|
||||
|
||||
|
@ -761,7 +761,7 @@ set in constructor */
|
|||
return a reference by default, instead it returns a copy.
|
||||
<note>
|
||||
<simpara>
|
||||
There is no performance loss (since php 4 and up use reference
|
||||
There is no performance loss (since PHP 4 and up use reference
|
||||
counting) returning copies instead of references. On the
|
||||
contrary it is most often better to simply work with copies
|
||||
instead of references, because creating references takes some
|
||||
|
@ -776,7 +776,7 @@ set in constructor */
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
// now we will change the name. what do you expect?
|
||||
// you could expect that both $bar and $globalref[0] change their names...
|
||||
// you could expect that both $bar1 and $globalref[0] change their names...
|
||||
$bar1->setName('set from outside');
|
||||
|
||||
// as mentioned before this is not the case.
|
||||
|
@ -784,14 +784,14 @@ $bar1->echoName();
|
|||
$globalref[0]->echoName();
|
||||
|
||||
/* output:
|
||||
set on object creation
|
||||
set from outside */
|
||||
set from outside
|
||||
set in constructor */
|
||||
|
||||
// let us see what is different with $bar2 and $globalref[1]
|
||||
$bar2->setName('set from outside');
|
||||
|
||||
// luckily they are not only equyl, they are thesame variable
|
||||
// thus $bar2->Name and $globalref[1]->Name are the same too
|
||||
// luckily they are not only equal, they are the same variable
|
||||
// thus $bar2->name and $globalref[1]->name are the same too
|
||||
$bar2->echoName();
|
||||
$globalref[1]->echoName();
|
||||
|
||||
|
|
Loading…
Reference in a new issue