3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $value_pattern = "\"(?:[^\"]|\")*\""; $variable_pattern = '\w+ *\= *' . $value_pattern; $block_pattern = "\[(?:[/]|\w)+(?: +' . $variable_pattern . ')*\]"; $input = 'Some text broken by an [img src="resx/img.jpg" alt="" full] and more text below.'; echo $block_pattern; $tokens = preg_split('/'.$block_pattern.'/', $input, -1, PREG_SPLIT_DELIM_CAPTURE);
based on gf0Hm
Output for 5.6.30, 7.0.30 - 7.3.0rc3
\[(?:[/]|\w)+(?: +' . \w+ *\= *"(?:[^"]|")*" . ')*\] Warning: preg_split(): Unknown modifier ']' in /in/lJ0TN on line 9
Output for hhvm-3.22.0
\[(?:[/]|\w)+(?: +' . \w+ *\= *"(?:[^"]|")*" . ')*\] Warning: Unknown modifier ']': [/\[(?:[/]|\w)+(?: +' . \w+ *\= *"(?:[^"]|")*" . ')*\]/] in /in/lJ0TN on line -1
Output for hhvm-3.18.5 - 3.21.3
\[(?:[/]|\w)+(?: +' . \w+ *\= *"(?:[^"]|")*" . ')*\] Warning: Unknown modifier ']': [/\[(?:[/]|\w)+(?: +' . \w+ *\= *"(?:[^"]|")*" . ')*\]/] in /in/lJ0TN on line 9