Welcome to WebmasterWorld Guest from 3.80.4.76

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

What does this return?

     
6:40 am on Apr 23, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 15, 2004
posts:1867
votes: 0


What does this return?

return ($num)? $num:1;

Habtom

9:49 am on Apr 23, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 13, 2006
posts:69
votes: 0


depends entirely on what it's used for. It's a shorthand if statement, the bit in brackets is the condition and the other parts are what to return if the conditio is true, then false
10:49 am on Apr 23, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 24, 2005
posts:121
votes: 0


"Return $num if $num exists, else return 1"
12:41 pm on Apr 23, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


It's called the Ternary Operator [php.net], Habtom. It is another of PHP's Comparison Operators.
1:50 pm on Apr 23, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 15, 2004
posts:1867
votes: 0


Thanks all. Thanks coopster.

Habtom

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members