Welcome Guest, Not a member yet? Register   Sign In
@$variablename or @$array_name[0] what does @ means???
#5

[eluser]Randy Casburn[/eluser]
Cough... CI has hundreds of these @ error suppressions throughout the entire library for extremely functional reasons. Is CI designed poorly? I think not.

@a123bcd -- at times, some of the PHP functions (file, streams like ftp, some graphics, DB, etc.) primarily focus is returning a handle to a file, or stream or image object or the like. If there is an error or warning they activate the internal PHP warning or error system with the standard warning or error codes. For instance if a file cannot be found, the fopen() function fires an error code E_WARNING but "returns" false.

So if you have your PHP configuration set to display warnings and errors, your most beautiful application just got an PHP warning message blasted all over it. Maybe you've seen this happen before.

So to answer your question, the @ symbol is the only PHP tool available to control the unwanted output of PHP warnings and errors that destroy our pages when we don't want them to.

This tool is used for many reasons. For instance, sometimes it is used to ENHANCE your design. For instance, let's take the fopen() example from above. Now that we've suppressed the nasty looking, uncontrolled PHP warning message, we can actually format our own message, place it in our beautiful application page anywhere we want, make it look real nice, and place the error on the page simply by using this variable $php_errormsg (assuming PHP error reporting is set up correctly -- read the docs).

I hope this is helpful,

Randy


Messages In This Thread
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-19-2008, 03:52 AM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-19-2008, 04:08 AM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-19-2008, 04:21 AM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-19-2008, 09:01 PM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-19-2008, 09:47 PM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-19-2008, 11:15 PM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-20-2008, 09:14 AM
@$variablename or @$array_name[0] what does @ means??? - by El Forum - 07-20-2008, 09:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB