Copy CodeThe code is as follows:
Class Foo
{
Private $name = ' hdj ';
Public Function GetName () {
return $this->name;
}
}
Class Bar extends Foo
{
Public $name = ' Deeka ';
}
$bar = new Bar;
Var_dump ($bar->name);
Var_dump ($bar->getname ());
Access control
Access control for a property or method is achieved by adding the keyword public, protected, or private earlier. A class member defined by public can be accessed anywhere, and a class member defined by protected can be accessed by the subclass and parent of its class (of course, the class where the member resides), while a class member defined by private can only be accessed by the class in which it resides.
Copy the Code code as follows:
$a = 3;
$b = 6;
if ($a = 5 | | $b = 7) {
echo $b. '
';
$a + +;
$b + +;
}
Var_dump ($a, $b);
Echo '
$a = (5 | | $b = 7) ';
Echo '
';
$a = 3;
$b = 6;
$c = 1;
if ($a = 5 | | $b = 7 && $c = 10) {
$a + +;
$b + +;
}
Var_dump ($a, $b, $c);
Echo '
&& Ratio | | High ';
Echo '
';
$a = 3;
$b = 6;
$c = 1;
if ($a = 0 | | $b = 7 && $c = 10) {
$a + +;
$b + +;
}
Var_dump ($a, $b, $c);
Echo '
';
Echo ' ';
Class Foo {
Private $name = ' hdj ';
Public Function GetName () {
return $this->name;
}
}
Class Bar extends Foo {
Public $name = ' Deeka ';
}
$bar = new Bar;
Var_dump ($bar->name);
Var_dump ($bar->getname ());
http://www.bkjia.com/PHPjc/328057.html www.bkjia.com true http://www.bkjia.com/PHPjc/328057.html techarticle Copy the code as follows: Class Foo {private $name = ' hdj '; public function getName () {return $this-name;}} class Bar extends Foo {Public $name = ' Deeka ';} $bar = new Bar; VA ...