PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I just need a good link to explain me what % and @ and other sign are used for..
as far as i know %with a number i think just give you a number of decimal you wanted.. like %2 or soemthing like that
@ i think is about error rpeort somehow.. god i don't know>>
please don't tell me to google.. i know how to google..just the keyword (not knowing php well enough) is kind hard.. php @ % ownt really work in google
so just a link..if you don't want to write it down..
Since i'm no good at explaining things, heres what the manual says on it.. (see error handling functions)
This will supress the injection of error messages into the data stream output to the web client. You might do this, for example, to supress the display of error messages were foo() a database function and the database server was down. However, you're probably better off using php configuration directives or error handling functions than using this feature.
people use it to make their own custom error sequence, its really of no great importance in my eyes.[/quote]
tim is right about the @ sign. As for the % sign, i've never seen it used like echo %2; NEVER!!! % is the modulus operator. Meaning it will return the remainder of a dvision problem... like:
Illusionist wrote:tim is right about the @ sign. As for the % sign, i've never seen it used like echo %2; NEVER!!! % is the modulus operator. Meaning it will return the remainder of a dvision problem... like:
9 % 2 = 1
100 % 13 = 9
Get it??
I'm also not that great at explaining things!!
The % symbol is also used for formatting in various print functions like sprintf and whatnot:
PHP Manual wrote:
A type specifier that says what type the argument data should be treated as. Possible types:
% - a literal percent character. No argument is required.
b - the argument is treated as an integer, and presented as a binary number.
c - the argument is treated as an integer, and presented as the character with that ASCII value.
d - the argument is treated as an integer, and presented as a (signed) decimal number.
u - the argument is treated as an integer, and presented as an unsigned decimal number.
f - the argument is treated as a float, and presented as a floating-point number.
o - the argument is treated as an integer, and presented as an octal number.
s - the argument is treated as and presented as a string.
x - the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters).
X - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters).
But I too would like to know when and why to use these.
well, technically, the % sign can have different meanings. Its depending on what sitution you use it in.
If your familar with regular expressions, its the same as a peroid.
MySQL interprets the % sign as for like searches to match character strings. its considered a wild card meaning "anything or all" exact or sub-sets matches.ie
%tim% would match, timmy, tim, timber, timberwolf,timisdumb, etc. Get it? a percent sign matches any string of zero or more characters.
Or the above post, i'm not to familiar with it however so that is the best I can do.