I continue to learn about PHP and PCRE. My question today is the following:
<?php
$search = "Money $ money $ money...";
/*I get "invalid"*/
if(preg_match("&money \$&", $search)){
echo 'Valid <br/>';
}else{
echo 'Invalid <br/>';
}
/*I get "valid"*/
if(preg_match('&money \$&', $search)){
echo 'Valid <br/>';
}else{
echo 'Invalid <br/>';
}
?>
I suppose when I use double quotes instead of single ones PHP is messing up with the encoding of ASCII character, but I do not totally understand why.
Can someone provide a detailed answer?