A small regex question

From: Online (online131_at_hotmail.com)
Date: 10/30/03


Date: 29 Oct 2003 16:00:25 -0800

Hello,

This code:

 <?php
        preg_replace_callback("/(a)|(b)/",
                              create_function('$x',
                                              'foreach ($x as $y => $z)'.
                                              'echo "\\\$y: $z<br>";'),
                              "b");
 ?>

Outputs:

 \0: b
 \1:
 \2: b

I expect 'b' to be placed in \1, but for some reason \1 contains a
null value and 'b' is moved to \2. Can someone please explain why it
happens?

Thank you