3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $regex = <<<REGEX / (?:\A|\n)\s* (?: (?:(@[\pL-_\]+)\ *(\()([^\)]*)(\)))| (?: (?:(@author)\ +([^<]+)(?:(\<)(.+?)(\>))?)| (@api)| (@category\ +([^ ]+))| (@copyright)| (@deprecated)| (@example\ +([^ ]+))| (@filesource)| (@global\ +([^ ]+))| (@ignore)| (@internal)| (@license\ +([^ ]+))| (?:(@link)\ +([^ ]+))| (@method)| (@package\ +([^ ]+))| (@param\ +([^ ]+)\ +([^ ]+))| (@property\ +([^ ]+)\ +([^ ]+))| (@property-read\ +([^ ]+)\ +([^ ]+))| (@property-write\ +([^ ]+)\ +([^ ]+))| (@return\ +([^ ]+))| (?:(@see)\ +([^ ]+))| (@since\ +([^ ]+))| (@source)| (@subpackage\ +([^ ]+))| (@throws\ +([^ ]+))| (@todo)| (@uses\ +([^ ]+))| (@var\ +([^ ]+))| (@version\ +([^ ]+))| (@[\pL-_]+) ) \ + (?s:(.*?)) ) (?=\n\s*@|\Z) /ux REGEX; $comment = <<<COMMENT @ORM\Type(name="") @see MyTag this is a @description that spans multiple lines @internal @author Mike van Riel <me@mikevanriel.com> COMMENT; var_dump(preg_match_all($regex, $comment, $matches, PREG_SET_ORDER)); var_dump($matches);
Output for 4.4.0 - 4.4.9, 5.0.5 - 7.1.0
int(2) array(2) { [0]=> array(59) { [0]=> string(21) " @see MyTag this is a" [1]=> string(0) "" [2]=> string(0) "" [3]=> string(0) "" [4]=> string(0) "" [5]=> string(0) "" [6]=> string(0) "" [7]=> string(0) "" [8]=> string(0) "" [9]=> string(0) "" [10]=> string(0) "" [11]=> string(0) "" [12]=> string(0) "" [13]=> string(0) "" [14]=> string(0) "" [15]=> string(0) "" [16]=> string(0) "" [17]=> string(0) "" [18]=> string(0) "" [19]=> string(0) "" [20]=> string(0) "" [21]=> string(0) "" [22]=> string(0) "" [23]=> string(0) "" [24]=> string(0) "" [25]=> string(0) "" [26]=> string(0) "" [27]=> string(0) "" [28]=> string(0) "" [29]=> string(0) "" [30]=> string(0) "" [31]=> string(0) "" [32]=> string(0) "" [33]=> string(0) "" [34]=> string(0) "" [35]=> string(0) "" [36]=> string(0) "" [37]=> string(0) "" [38]=> string(0) "" [39]=> string(0) "" [40]=> string(0) "" [41]=> string(4) "@see" [42]=> string(5) "MyTag" [43]=> string(0) "" [44]=> string(0) "" [45]=> string(0) "" [46]=> string(0) "" [47]=> string(0) "" [48]=> string(0) "" [49]=> string(0) "" [50]=> string(0) "" [51]=> string(0) "" [52]=> string(0) "" [53]=> string(0) "" [54]=> string(0) "" [55]=> string(0) "" [56]=> string(0) "" [57]=> string(0) "" [58]=> string(9) "this is a" } [1]=> array(59) { [0]=> string(26) " @author Mike van Riel <me" [1]=> string(0) "" [2]=> string(0) "" [3]=> string(7) "@author" [4]=> string(13) "Mike van Riel" [5]=> string(0) "" [6]=> string(0) "" [7]=> string(0) "" [8]=> string(0) "" [9]=> string(0) "" [10]=> string(0) "" [11]=> string(0) "" [12]=> string(0) "" [13]=> string(0) "" [14]=> string(0) "" [15]=> string(0) "" [16]=> string(0) "" [17]=> string(0) "" [18]=> string(0) "" [19]=> string(0) "" [20]=> string(0) "" [21]=> string(0) "" [22]=> string(0) "" [23]=> string(0) "" [24]=> string(0) "" [25]=> string(0) "" [26]=> string(0) "" [27]=> string(0) "" [28]=> string(0) "" [29]=> string(0) "" [30]=> string(0) "" [31]=> string(0) "" [32]=> string(0) "" [33]=> string(0) "" [34]=> string(0) "" [35]=> string(0) "" [36]=> string(0) "" [37]=> string(0) "" [38]=> string(0) "" [39]=> string(0) "" [40]=> string(0) "" [41]=> string(0) "" [42]=> string(0) "" [43]=> string(0) "" [44]=> string(0) "" [45]=> string(0) "" [46]=> string(0) "" [47]=> string(0) "" [48]=> string(0) "" [49]=> string(0) "" [50]=> string(0) "" [51]=> string(0) "" [52]=> string(0) "" [53]=> string(0) "" [54]=> string(0) "" [55]=> string(0) "" [56]=> string(0) "" [57]=> string(0) "" [58]=> string(3) "<me" } }
Output for 4.3.11, 5.0.0 - 5.0.4
Warning: preg_match_all(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 62 in /in/UsgnW on line 54 bool(false) array(0) { }
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 62 in /in/UsgnW on line 54 bool(false) array(0) { }