这章其实将的是对象的浅拷贝和深拷贝,推荐大家去看看这个http://www.cnblogs.com/taijun/p/4208008.html,讲的挺详细的
2017-06-21
<?php
//创建一个关联数组,关联数组的键“orange”,值是“橘子”
$fruit = array('apple'=>'苹果','banana'=>'香蕉','orange'=>'橘子');
print_r($fruit['orange']);
?>
//创建一个关联数组,关联数组的键“orange”,值是“橘子”
$fruit = array('apple'=>'苹果','banana'=>'香蕉','orange'=>'橘子');
print_r($fruit['orange']);
?>
2017-06-21
1.$arr[0] = '苹果';
2.$arr = array('苹果');
3.$arr = array('0'=>'苹果');
三种方法
2.$arr = array('苹果');
3.$arr = array('0'=>'苹果');
三种方法
2017-06-21
public function __call($name,$args){
if($name =='speedDown'){
$this->speed -= 10;
}
}
if($name =='speedDown'){
$this->speed -= 10;
}
}
2017-06-20
class Truck extends Car{
public function obj(){
$this->speed = parent::speedUp() + 50;
return $this->speed;
}
}
$car = new Truck();
$car->obj();
echo $car->speed;
public function obj(){
$this->speed = parent::speedUp() + 50;
return $this->speed;
}
}
$car = new Truck();
$car->obj();
echo $car->speed;
2017-06-20
循环四次生成四个随机数,每次照字符的方法加在后面$cade.=rand(0,9)---->$cade=$cade.rand(0,9)
2017-06-19