| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2008-01-06 20:07 UTC] johannes@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 12:00:01 2025 UTC | 
Description: ------------ what I'm proposing is, adding a function (perhaps named preg_compile) that would accept 1 string parameter $pattern. the function would return a resource with the compiled pcre code which could be used anywhere in the other preg_* functions where a string for the pattern would be accepted. this way if you need to do 1000s of pcre matches of the same pattern(s) on different data, it would not require internally doing pcre_compile() over and over, saving very valuable cpu time. Reproduce code: --------------- <?php $pattern = preg_compile("/s[i1]mpl[e3] pattern here/i"); // returns a new type of resource if (preg_match($pattern, "simple pattern here")) // which can then be used anywhere the normal string pattern could be echo "pattern matches\n"; ?> Expected result: ---------------- well, obviously if this feature was added i'd expect to see: pattern matches Actual result: -------------- since this is not actually implemented i'd just get a fatal error :P