www.webdeveloper.com
Results 1 to 10 of 10

Thread: What doe sthis mean

  1. #1
    Join Date
    Jun 2003
    Posts
    52

    What doe sthis mean

    $a = ("php"=="php") ? "true":"false";

    hi can you break this down into english please

    i under stand == and $a but what i ? and :

    thanks

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    In english:

    If "php" equals "php" set $a to "true". If "php" (or rather, the first condition) does not equal "php" (the second condition) set $a to false.

    Basically, it is a simplified if statement that would be equivalent to this:

    PHP Code:
    if ("php" == "php") {
        
    $a "true";
    }
    else {
        
    $a "false";


    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  3. #3
    Join Date
    Jun 2003
    Posts
    52
    thanks for th if statement
    i understand that.

    is it comman to use this shortened method?

    andrew

  4. #4
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Not really -- at least not in PHP. It is more common in javascript. I think this is the first time I've seen it in PHP...

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  5. #5
    Join Date
    Jun 2003
    Posts
    52
    dont you think that it is a bit silly of them to put it in a beginners php book.

    anyway thanks for the help

    Andrew

  6. #6
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    It actually is good to know, as you can shorten certain bits of code considerably using it. But, as you said, it may be a bit premature in a beginners book...

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  7. #7
    Join Date
    Jun 2003
    Posts
    52
    i checked out your site and it rocks..very nice design

    I'm more of a flash html guy myself

    i'd be interested what you think of this
    http://www.hamandmushroom.co.za/test/andrew.swf

    my action script is better than my php and java script

    Andrew

  8. #8
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Thank you...

    About your site...

    That would make a better game than navigation system. Kinda hard to use, IMO. Also, all the pages that popped up gave a 404...

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  9. #9
    Join Date
    Jun 2003
    Posts
    52
    and from a action script point of view?

    what did you think?

    Andrew

  10. #10
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    I know very little action script, but it seemed to work well...

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles