Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "preg_match (a?)<sup>n</sup>a<sup>n</sup> on a<sup>n</sup>...<br/>";
- $regex = "";
- $haystack = "";
- ini_set( "pcre.recursion_limit", 100000 );
- for( $i = 1; $i < 50; $i++ ){
- $regex = "a?".$regex."a";
- $haystack = "a".$haystack;
- $time_start = microtime(true);
- $result = preg_match("/".$regex."/",$haystack);
- $time_end = microtime(true);
- $time = $time_end - $time_start;
- if( $result === FALSE ){
- echo "BULLSHIT! ";
- }
- echo "i = $i: ".number_format($time,5)." seconds, answer: $result<br/>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment