$p = '/\w+\s\w+/';
echo $match[0];
$p = '/name:(\w+\s\w+)/';
$str = "name:steven jobs";
preg_match($p, $str, $match);
echo $match[1];
$p = '/(\w+\s\w+)/';
echo $match[1];
echo $match[0];
$p = '/name:(\w+\s\w+)/';
$str = "name:steven jobs";
preg_match($p, $str, $match);
echo $match[1];
$p = '/(\w+\s\w+)/';
echo $match[1];
2016-06-13
亲测下面的都行,多试试可以帮助理解:
//$p = '/[0-9]*-[0-9]*/';
//$p = '/[0-9]+-[0-9]+/';
//$p = '/[0-9]+.[0-9]+/';
//$p = '/\d++.\d++/';
//$p='/\d+-\d+/';
//$p='/\d*-\d*/';
//$p='/\d{3}-\d{8}/';
//$p = '/[0-9]*-[0-9]*/';
//$p = '/[0-9]+-[0-9]+/';
//$p = '/[0-9]+.[0-9]+/';
//$p = '/\d++.\d++/';
//$p='/\d+-\d+/';
//$p='/\d*-\d*/';
//$p='/\d{3}-\d{8}/';
2016-06-13
class Truck extends Car{
public function speedUp() {
$this->speed += 10;
for($i=10;$i<60;$i++){
$this->speed+=1;
}
return $this->speed;
}
}
public function speedUp() {
$this->speed += 10;
for($i=10;$i<60;$i++){
$this->speed+=1;
}
return $this->speed;
}
}
2016-06-13