Is there a native PHP function for converting a string to its HEX representation that can be then eval()'d as a string, such as:
"ABC" => "\x41\x42\x43"
I know it can be done in several steps, I'm just wondering if I'm unnecessarily complicating something that could be done with a single, native function?
bin2hex(), then you'd have to add the\xto each character manually:'\x' . implode( '\x', array_map( 'bin2hex', str_split( 'ABC'))));eval()'dif it is astring?"\x41\x42\x43"is valid PHP, and could be eval'd.