What is the difference between characters 23 and x23 in PHP?

General discussions related to php

Moderators: macek, egami, gesf

phpdevelopers
New php-forum User
New php-forum User
Posts: 7
Joined: Wed May 16, 2012 12:49 am
Contact:

What is the difference between characters 23 and x23 in PHP?

Postby phpdevelopers » Wed Jun 13, 2012 4:15 am

What is the difference between characters 23 and x23 in PHP?

User avatar
ejsexton82
New php-forum User
New php-forum User
Posts: 86
Joined: Mon Jun 04, 2012 10:05 pm
Location: Ankara, Turkey
Contact:

Re: What is the difference between characters 23 and x23 in

Postby ejsexton82 » Wed Jun 13, 2012 9:43 pm

"23" is a decimal number. "0x23" is a hexidecimal representation of the decimal number "35".

Code: Select all

echo "23: " . 23 . "<br/>";
echo "0x23: " . 0x23 . "<br/>";


These number also have corresponding UTF-8 characters. The "23" character is described as the End Transmission Block (ETB) character, which is "invisible" if you try to print it on screen. The "0x23" character, or "35" character, is the pound sign (#).

Code: Select all

echo "Character 23: &#23;<br/>";
echo "Character x23: &#x23; or &#35; <br/>";


I hope that helps. Good luck!


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest