What is this called

Discussion in 'PHP' started by ttyler333, Jun 30, 2011.

  1. #1
    Hey so yeah i help people around on here but i need help now.. Drawing a blank.


    What is this called?

    ex: ($var == null ? SOMETHING : default);
     
    ttyler333, Jun 30, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Shorthand syntax
     
    jestep, Jun 30, 2011 IP
  3. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #3
    Alex Roxon, Jun 30, 2011 IP
  4. ttyler333

    ttyler333 Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #4
    Ive actually heard of shorthand syntax, i forgot the name. However it can have both names :p Ones more of a common nickname? Anywho, Thanks guys :)
     
    ttyler333, Jun 30, 2011 IP
  5. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #5
    Ternary operator is the technical name for what you've described. Shorthand syntax could apply to anything. For instance, shorthand for $num = $num + 1 would be $num++ or $num += 1.
     
    Alex Roxon, Jun 30, 2011 IP
  6. ttyler333

    ttyler333 Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #6
    Yeah, i saw that too after more research on trying to do some pretty fancy ternary operations. lol. Thanks though. Also saw that shorthand could be <?=$var?>
     
    ttyler333, Jun 30, 2011 IP
  7. dakshhmehta

    dakshhmehta Active Member

    Messages:
    220
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    85
    #7
    <?=$var?> i think is same as <?php echo $var; ?>
     
    dakshhmehta, Jun 30, 2011 IP