Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorgekko
    • CommentTimeDec 14th 2007
     
    What does it mean "@" before variable?
    For example : $this->post = $this->Post->find(@$this->params['id'], array('include'=>'comments'));
    @$this->
    ~~~~~~~
    If "@" represented before variant, it doesn't occur syntax error. so I don't mind what "@" means...
    I guess the variables with "@" has peculiar meaning, but I couldn't find definite explanation.

    Thanks.
    • CommentAuthorasejua
    • CommentTimeDec 14th 2007
     

    That @ supresses the error messages (or warnings, or notices) when used with a variable or a function.

    For example in that case, if $this->params['id'] is not set, php won't generate the warning message saying that variable is undefined. You can use it too with functions like @mysql_connect(.....) that's useful to get rid of php errors to handle your own.

    Here you have a bit more info http://www.php.net/manual/en/language.operators.errorcontrol.php

    • CommentAuthorgekko
    • CommentTimeDec 15th 2007
     
    Thank you very much.
    Your answer reminds me that I've used "@" before a function, for example, @fopen().
Add your comments
    Username Password
  • Format comments as