PHP xf0 represents 0xF0?

Asked

Viewed 57 times

5

If \xF0 represents a hexa as well as 0xF0, because their exit is different?

echo "\xF0";
echo 0xF0;

I can’t really find any information on that notation \xF0 in the PHP manual.

1 answer

5


These are different things. The first example is a string, and the escape notation \xHH represents the hexadecimal code of a character. Already the 0xF0 is a number, integer, represented as literal hexadecimal (i.e., base 16). So in the first case the hex code represents a character of a table, while in the second case it is simply a number.

  • Hey and in the following code: >> privkey = os.urandom(32) >>> print(privkey) b' x9a xfbch x05 xc3| xdf xfc xbJ x89g' ? Can’t this be hexa or can it somehow? The above code is python

  • That looks like a string

Browser other questions tagged

You are not signed in. Login or sign up in order to post.