I want to convert normal text to x codes for e.g x14x65x60
For example :
JavaScript
x
normal text = "base64_decode"
converted x codes for above text = "x62141x73145x3664x5f144x65143x6f144x65"
How to do this? Thanks in advance.
Advertisement
Answer
PHP 5.3 one-liner:
JavaScript
echo preg_replace_callback("/./", function($matched) {
return 'x'.dechex(ord($matched[0]));
}, 'base64_decode');
Outputs x62x61x73x65x36x34x5fx64x65x63x6fx64x65