Hi
In perl, I can write: (Syntax may not be 100% but you get the idea)
my $var=foobarbar;
$var=~m/foo(.*)ar^/;
print $0;
and get barb as the result. (Because I match the contents of var)
If i try and replicate this in PHP, it does not work (It seems to trip up because you cannot write things like $1 on new lines)
Is this really the case? How can I get around this?
Thanks
In perl, I can write: (Syntax may not be 100% but you get the idea)
my $var=foobarbar;
$var=~m/foo(.*)ar^/;
print $0;
and get barb as the result. (Because I match the contents of var)
If i try and replicate this in PHP, it does not work (It seems to trip up because you cannot write things like $1 on new lines)
Is this really the case? How can I get around this?
Thanks
Last edited: