Results 1 to 6 of 6

Thread: What does '@' do in front of a variable?

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post What does '@' do in front of a variable?

    Hi All,

    My first time posting on any php forum but i've searched all over (maybe not using the right search terms).

    I'm trying to debug a script and ran into a variable assignment i hadn't seen before - @$$value.

    I know $$ means value is a variable variable. I also know '@' suppresses error messages in functions but i can't figure out what the combination actually does.

    The script actually still works without the '@' but i'm curious.

    Thanks in advance.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    As you say, it prevents error messages from being displayed.

    As such, I can only assume that it doesn't give you an error if there is something wrong with "$$var".

    Perhaps it's used in case "$var" has no value, in which case, it would give you an error because you're trying to assign a value to "$" ($blank).

  3. #3
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot. Didn't think of that. I'll have a go at introducing errors to see what happens with and without the '@'.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yeah. That's a good way to test.
    I've only seen the @ used on functions, but I would assume other things would work in a similar fashion.

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I would think that was it. I've never seen this before either. I'd like to have a look at this code: it's either very badly written, or very well written.

    Lol, @$$value.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    it's either very badly written, or very well written.

    So true. Ha.

    Well, really, that's just intermediate. The users who are using @$$$$value are the ones who really get it. ^_^


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •