kuau
08-08-2008, 07:41 PM
I have seen the % sign used in a lot of different contexts. John Scheuer explained one of them as follows:
There would almost never be a %3 in a query, perhaps a %3e, or %3E, or %20 - that one's really common, it's a space.
The % sign just means that the next two characters make up a hex code that corresponds to the character being escaped (certain characters don't do well in URLs). If you had a chart of characters with their hex codes, that would tell you. Generally you don't need to know, they just represent characters that are in the link. You can always decipher any given one by making up a little script, ex:
Code:
alert(unescape('%3e')); Here's a fairly good table of hex (and other, use the hex column) codes for common characters:
http://en.wikipedia.org/wiki/ASCII#A...ble_characters
But now I have found another example that doesn't seem to fit under the explanation above. What does % mean used in this context?... thanks.
$i = $i % 7;
There would almost never be a %3 in a query, perhaps a %3e, or %3E, or %20 - that one's really common, it's a space.
The % sign just means that the next two characters make up a hex code that corresponds to the character being escaped (certain characters don't do well in URLs). If you had a chart of characters with their hex codes, that would tell you. Generally you don't need to know, they just represent characters that are in the link. You can always decipher any given one by making up a little script, ex:
Code:
alert(unescape('%3e')); Here's a fairly good table of hex (and other, use the hex column) codes for common characters:
http://en.wikipedia.org/wiki/ASCII#A...ble_characters
But now I have found another example that doesn't seem to fit under the explanation above. What does % mean used in this context?... thanks.
$i = $i % 7;