标签:style blog color io sp div on log cti
<?php class Cat{ //public 访问修饰符 public $name; public $age; } //创建 $cat1=new Cat; $cat1->name="小白"; //访问某个对象的某个属性 $对象名->属性名 echo $cat1->name; echo "<br/>"; class Person { public $name; public $age; } $a=new Person(); $a->name="小明"; $a->age=20; // $b=$a; echo $a->name."<br/>"; echo $b->name."<br/>"; echo "<br/>"; $p1=new Person(); $p1->name="张三"; $p1->age=7; function test1($p) { $p->name="王五"; } echo $p1->name; //输出张三。证明说传的是值而不是地址传递 ?>
标签:style blog color io sp div on log cti
原文地址:http://www.cnblogs.com/sumg/p/4052805.html