<?php
$a = 'hello, [how]foo[how]bar. please don\'t remove [are] you?';
echo preg_replace('~\[.*?\]~', '', $a);
echo PHP_EOL . "there should be no space between foo and bar :)";
hello, foobar. please don't remove you?
there should be no space between foo and bar :)
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
hello, foobar. please don't remove you?
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/CTv9s on line 5
PHP_EOLthere should be no space between foo and bar :)