![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Newbie
|
"$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. |
|
|
|
|
|
#12 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#13 |
|
Expert Programmer
|
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.
|
|
|
|
|
|
#14 |
|
Programmer
|
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|