Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorgekko
     
    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
     

    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
     
    Thank you very much.
    Your answer reminds me that I've used "@" before a function, for example, @fopen().