Why do I get the extra "3" in this replacement?

$s='This is 3a and 3b';


preg_replace($pattern, $replace, $s) gives 'This is [3a] and [3b]'

I thought $0 refers only to the match in the parenthesis. Same with $replace='[\0]';
I want: 'This is [a] and '

Thanks for any help, no doubt something trivial!

OK, solved it myself!
I realise now that $0 refers to the whole matched pattern and $1 to the first match subpattern. So what I needed was $1 instead of $0.
Simple really, but that took me two hours to figure.