I have used two testers of regex, http://www.pagecolumn.com/tool/pregtest.htm and http://www.spaweditor.com/scripts/regex/ both return the results I want but when ever I go ‘Live’ I get no results.
Heres the script I’m trying to get working:
$ptn = "/\\x(..)/";
$str = "\x47\x4c\x4f\x42\x41\x4c\x53";
preg_match_all($ptn, $str, $matches, PREG_PATTERN_ORDER);
print_r($matches);
Anyone know where I’m going wrong?
PHP converts your
$strstring into its actual characters, you are actually testing the string"GLOBALS".If you don’t want escape sequences to be parsed, use single quotes: