A small regex question
From: Online (online131_at_hotmail.com)
Date: 10/30/03
- Next message: Andy Hassall: "Re: A small regex question"
- Previous message: PenguinsAnonymous: "Re: Dupe Prevent on Form Submit"
- Next in thread: Andy Hassall: "Re: A small regex question"
- Reply: Andy Hassall: "Re: A small regex question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Andy Hassall: "Re: A small regex question"
- Previous message: PenguinsAnonymous: "Re: Dupe Prevent on Form Submit"
- Next in thread: Andy Hassall: "Re: A small regex question"
- Reply: Andy Hassall: "Re: A small regex question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]