コードの解析
$str = 'My name is Michael. I am a sportsman!';
preg_match('|My name is (.*?)\. I am a (.*?)|', $str, $m);
print_r($m);
文字列を返します:
Array ( [0] => My name is Michael. I am a [1] => Michael [2] => )
はどこsportsman
ですか?
コードの解析
$str = 'My name is Michael. I am a sportsman!';
preg_match('|My name is (.*?)\. I am a (.*?)|', $str, $m);
print_r($m);
文字列を返します:
Array ( [0] => My name is Michael. I am a [1] => Michael [2] => )
はどこsportsman
ですか?