0

I have a code like this:

CONVERT(binary, 'Hello World!')

Is it possible to convert that into pure php code?

This trick didn't work:

$data = (binary) 'Hello World!';

I want the output similar to this:

0x316B646A666762663100000000
8
  • Does this answer your question? PHP convert string to hex and hex to string Commented Jul 17, 2020 at 9:18
  • I tried many of them and none work. Commented Jul 17, 2020 at 9:30
  • You can run shell command via php and use mysql -e option in CLI for execute deisred function or procedure Commented Jul 17, 2020 at 9:31
  • 2
    "I tried many of them and none work. " then post your attempts and explain why they didn't work and/or the error you received. Commented Jul 17, 2020 at 9:39
  • @Larnu I did some experiment and I guess the string to hex conversion login on the given link works but I'll have to add 0x as prevalue and the output should be exactly 28 characters so I'll have to add 0 as postvalue until it reaches the 28 characters. Thank you. Commented Jul 17, 2020 at 9:45

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.