Page 1 of 1

A small question that can be quickly answered

Posted: Mon Mar 22, 2004 11:40 am
by Draco_03
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..

thank you
8)

Posted: Mon Mar 22, 2004 1:38 pm
by tim
the @ sign your right about error.

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]

Posted: Mon Mar 22, 2004 1:46 pm
by Illusionist
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!!

Posted: Mon Mar 22, 2004 1:55 pm
by Steveo31
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.

Posted: Mon Mar 22, 2004 2:07 pm
by tim
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.

Posted: Mon Mar 22, 2004 2:31 pm
by Draco_03
ty guys.. :)

tim about the %
%tim%
could you get something like mynameistimberlan?
..

Posted: Mon Mar 22, 2004 2:34 pm
by magicrobotmonkey
Whiler we're on the subject, what about & ?

Posted: Mon Mar 22, 2004 2:52 pm
by tim
just a single '&' is a bitwise operator.

http://www.php.net/manual/en/language.o ... itwise.php