PHP preg_match()


개요

PHP preg_match()
$subject = "abcdef";
$pattern = '/^def/';
preg_match($pattern, $subject, $matches);
print_r($matches);
# Array
# (
# )
$subject = "defghi";
$pattern = '/^def/';
preg_match($pattern, $subject, $matches);
print_r($matches);
# Array
# (
#     [0] => def
# )

같이 보기

참고