3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 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);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $comment in /in/pgbvq on line 4 Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/pgbvq on line 4 array(0) { }
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $comment in /in/pgbvq on line 4 array(0) { }
Output for 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: comment in /in/pgbvq on line 4 array(0) { }
Output for 7.3.32 - 7.3.33, 7.4.26
array(0) { }
Output for 5.0.4
Notice: Undefined variable: comment in /in/pgbvq on line 4 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 170 in /in/pgbvq on line 48 array(0) { }
Output for 4.3.11, 5.0.0 - 5.0.3
Notice: Undefined variable: comment in /in/pgbvq on line 4 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 170 in /in/pgbvq on line 48 array(0) { }
Output for 4.4.0 - 4.4.9
Notice: Undefined variable: comment in /in/pgbvq on line 4 array(0) { }
Output for 4.3.0 - 4.3.10
Notice: Undefined variable: comment in /in/pgbvq on line 4 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 170 in /in/pgbvq on line 48 array(0) { }

preferences:
277.16 ms | 402 KiB | 456 Q