Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 10th, 2006, 10:09 PM   #11
mongeau
Newbie
 
mongeau's Avatar
 
Join Date: Apr 2006
Location: Fargo, ND
Posts: 29
Rep Power: 0 mongeau is on a distinguished road
Send a message via MSN to mongeau
"$content = isset($_GET['content']) ? $_GET['content'] : null;"

^^^This is an interesting statement. Could you explain what the '?' does and the ':' ?
__________________
I wish I was you, so I could be friends with me.
mongeau is offline   Reply With Quote
Old Apr 10th, 2006, 10:19 PM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It's from the C/C++ ternary statement. The expression (isset (...)) is evaluated. If it's true, assignment is made from the first option; if false, from the second. Similar, also, to the 3-part if in VBA: if (a, trueChoice, falseChoice). Ooble's approach will set $content to NULL if the get variable is null OR does not exist. The is_set thangy is a tad more exhaustive than 'empty' or just 'if ($_GET...).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 10th, 2006, 11:17 PM   #13
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Yes, normally I would use Ooble's way. I was actually wondering why he didn't GET the variable first, and check to see if there was a value. I don't know what the extract was, but I figured that it might have been a better solution.
Booooze is offline   Reply With Quote
Old Apr 13th, 2006, 9:44 PM   #14
drifter
Programmer
 
drifter's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia
Posts: 39
Rep Power: 0 drifter is an unknown quantity at this point
Send a message via ICQ to drifter Send a message via MSN to drifter
Thanks guys, I appreciate your input!

And Thanks Ooble, that code actually makes more sense to me, not that the other didn't this one just logically steps better in my mind.
__________________
Only two things are infinite, the universe and human stupidity, and im not sure about the former.
drifter is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC