class Foo
{
private $name =
public function getName(){
return $this
}
}
class Bar extends Foo
{
public $name =
}
$bar = new Bar;
var_dump($bar
var_dump($bar
訪問控制
對屬性或方法的訪問控制
<?php
$a =
$b =
if($a =
echo $b
$a++;
$b++;
}
var_dump($a
echo
echo
$a =
$b =
$c =
if($a =
$a++;
$b++;
}
var_dump($a
echo
echo
$a =
$b =
$c =
if($a =
$a++;
$b++;
}
var_dump($a
echo
echo
class Foo {
private $name =
public function getName() {
return $this
}
}
class Bar extends Foo {
public $name =
}
$bar = new Bar;
var_dump($bar
var_dump($bar
From:http://tw.wingwit.com/Article/program/PHP/201311/20949.html