This article mainly introduces the Preg_match function of PHP in the string length problem, if you also encountered Preg_match is always extracted content is blank or extracted, it may be encountered this problem, the need for friends can refer to the
Project, with Preg_match is to extract the target content, dead and dead have problems, the code measured to death.
Later suspected PHP Preg_match has string length limit, sure enough, found that the value of "Pcre.backtrack_limit" by default only set 100000.
Solution: Ini_set (' Pcre.backtrack_limit ', 999999999);
Note: This parameter is available after PHP version 5.2.0.
In addition to say about: Pcre.recursion_limit
Pcre.recursion_limit is the recursive limit of the pcre, which, if set to a large value, consumes all the available stacks of the process and eventually causes PHP to crash.
can also be limited by modifying the configuration: Ini_set (' Pcre.recursion_limit ', 99999);
In the actual project application, it is best to limit the memory setting: Ini_set (' memory_limit ', ' 64M '); , which is more secure.