\0
will also match the entire matched expression without doing an explicit capture using parenthesis.
preg_replace("/[A-Z]/", "\\0", $str)
As always, you can go to php.net/preg_replace or php.net/ to search the documentation quickly. Quoth the documentation:
\ 0 sau $ 0 se referă la textul care corespunde întregului model.