$p="/<li>(.*?)<\/li>/i";
preg_match_all($p, $str, $matches);
preg_match_all($p, $str, $matches);
2017-07-14
public function __call($name,$args){
if($name=='speedDown'){
$this->speed-=10;
}
}
if($name=='speedDown'){
$this->speed-=10;
}
}
2017-07-13
class Truck extends Car{
public function speedUp(){
parent::speedUp();
$this->speed+=50;
return $this->speed;
}
}
public function speedUp(){
parent::speedUp();
$this->speed+=50;
return $this->speed;
}
}
2017-07-13
<?php
//分隔字符串
$str = 'sun-moon-star';
$array=explode("-",$str);
foreach($array as $key =>$a){
echo $a;
}
?>
//分隔字符串
$str = 'sun-moon-star';
$array=explode("-",$str);
foreach($array as $key =>$a){
echo $a;
}
?>
2017-07-12
$str = preg_replace('/(\w+.\w+)/','<em>$1</em>',$str);
2017-07-12
class Run{
public static function say1(){
return 1;
}
public static function say2(){
return 2;
}
public static function say3(){
return 3;
}
}
echo Run::say1()."<br>";
echo Run::say2()."<br>";
$three = 'say3';
$className = 'Run';
echo $className::$three();
public static function say1(){
return 1;
}
public static function say2(){
return 2;
}
public static function say3(){
return 3;
}
}
echo Run::say1()."<br>";
echo Run::say2()."<br>";
$three = 'say3';
$className = 'Run';
echo $className::$three();
2017-07-12