3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function short_check($a) { var_dump($a); if($a[1]==$a[2]) return ''; return $a[0]; } $_content = 'hello [shortcode some params]inner content[/shortcode] there'; $_content = preg_replace_callback('#\[(\S+)[^\]]+[^\[]+\[\/(\S+)\]#iu', 'short_check', $_content); echo $_content;
based on YhnuN
Output for 5.3.17 - 7.2.0
array(3) { [0]=> string(48) "[shortcode some params]inner content[/shortcode]" [1]=> string(9) "shortcode" [2]=> string(9) "shortcode" } hello there