3v4l.org

run code in 300+ PHP versions simultaneously
<?php $comment = <<<COMMENT #@+ This is a summary. This is a description. COMMENT; // clears all extra horizontal whitespace from the line endings // to prevent parsing issues $comment = preg_replace('/\h*$/Sum', '', $comment); /* * Splits the docblock into a short description, long description and * tags section * - The short description is started from the first character until * a dot is encountered followed by a newline OR * two consecutive newlines (horizontal whitespace is taken into * account to consider spacing errors) * - The long description, any character until a new line is * encountered followed by an @ and word characters (a tag). * This is optional. * - Tags; the remaining characters * * Big thanks to RichardJ for contributing this Regular Expression */ preg_match( '/ (\#\@\+|\#\@\-)? \A ( [^\n.]+ (?: (?! \. \n | \n{2} ) # disallow the first seperator here [\n.] (?! [ \t]* @\pL ) # disallow second seperator [^\n.]+ )* \.? ) (?: \s* # first seperator (actually newlines but it\'s all whitespace) (?! @\pL ) # disallow the rest, to make sure this one doesn\'t match, #if it doesn\'t exist ( [^\n]+ (?: \n+ (?! [ \t]* @\pL ) # disallow second seperator (@param) [^\n]+ )* ) )? (\s+ [\s\S]*)? # everything that follows /ux', $comment, $matches ); array_shift($matches); var_dump($matches);

preferences:
40.66 ms | 402 KiB | 5 Q