3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $text = "[text] (more text) (text...) [text!] (last text)"; preg_match_all('/[\[\(](.*?)[\]\)]/', $text, $matches, PREG_SET_ORDER, 0); $texts = array_column($matches, 1); var_dump($texts);
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
array(5) { [0]=> string(4) "text" [1]=> string(9) "more text" [2]=> string(7) "text..." [3]=> string(5) "text!" [4]=> string(9) "last text" }