이것이 (다른 사람이 explode
를 사용하여 제안 - 내가 다른 해결책을 제시하고 있습니다) 같은 약 :
$str = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
if (preg_match('/^([^\.]*)/', $str, $matches)) {
echo $matches[1] . '.';
}
정규식 것입니다 :
- 문자열 시작 부분에서 시작 :
^
- a가 아닌 다른 것과 일치합니다. : 시간의
[^\.]
- 임의의 수 :
[^\.]*
, 당신은 출력의 끝에 .
를 원하고 .
이 정규식과 일치하지 않는 한, 당신이 사용하는 경우 다시 추가해야합니다 정규식에서 무엇을 찾았습니까?
우리가 여기 정말 기본에있다가 sory – dynamic
XD,하지만 난 사람들이 :)에 대해 무슨 말을 알 필요가 explode 및 strpos 참조하십시오이 왜 stackoverflow 사랑 해요. –
http://php.net/string을 사용해 보셨습니까? 사람들은 당신이 설명서에서 찾을 수없는 것을 말하지 않을 것입니다. –