
PHP 7.4 부터는 mb_ereg_search_regs 함수가 사용되지 않습니다. 대신 preg_match_all 함수를 사용할 수 있습니다.
#hostingforum.kr
php
preg_match_all($pattern, $string, $matches);
이전의 mb_ereg_search_regs 함수와 동일하게 사용할 수 있습니다.
예를 들어, mb_ereg_search_regs 함수를 사용하여 'hello'가 포함된 문자열을 찾는 예제는 다음과 같습니다.
#hostingforum.kr
php
$pattern = '/hello/';
$string = 'hello world';
preg_match_all($pattern, $string, $matches);
print_r($matches[0]);
이 코드는 'hello'가 포함된 문자열을 찾고, matches 배열에 결과를 저장합니다.
2025-07-09 18:09