Forum Moderators: coopster

Message Too Old, No Replies

syntax question

quickie

         

Scally_Ally

1:06 pm on May 17, 2007 (gmt 0)

10+ Year Member



Just a quickie...

I see this bit of code about quite a bit, not just on the function below but on a lot of functions.

@file_get_contents("whatever"); 

What does the @ symbol do?

Also when calling functions in classes i see this aswell.

$myClass::myFunction();

What does the :: mean? is it just the same as

$myClass->myFunction();

Thanks in advance.

Ally

[edited by: Scally_Ally at 1:07 pm (utc) on May 17, 2007]

henry0

1:48 pm on May 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



@ should not be used while testing
it suppresses most error messages

:: is using a PEAR ()

MatthewHSE

1:49 pm on May 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<edit> I had to watch less time than I expected - Henry beat me to the punch on both counts! ;) </edit>

The '@' tells the function that if it fails, it should fail silently. Sorry I don't know about the other question, but I'll be watching this thread for the answer! ;)

[edited by: MatthewHSE at 1:50 pm (utc) on May 17, 2007]

eelixduppy

1:51 pm on May 17, 2007 (gmt 0)



the
::
is the scope resolution operator [php.net] used in classes.

jatar_k

1:55 pm on May 17, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



and for @

[php.net...]

Scally_Ally

2:25 pm on May 17, 2007 (gmt 0)

10+ Year Member



Thanks for the help everyone..
Much appreciated..

henry0

3:21 pm on May 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



:: "Paamayim Nekudotayim"
very easy to use in a conversation :)