Hi I’m using php to program my site and I’ve been reading loads about preg_match and trying lots of examples. What I’m trying to do is something like below…
if(preg_match('These characters'), $myVariable, matches)){
Find and remove found characters from $myVariable;
}
I’m pretty sure this is obvious to php experts but it’s had me stuck after hours of trying and reading.
Thanks in advance
You don’t need to check for a match before doing a replace. It’s like if you were to do:
It just won’t replace anything. Same goes for
preg_replace: If there is no match, it just does nothing.