$ x ? 0 : $ x ... syntax help
Posted 07 July 2006 - 05:55 AM
$x->var = $ x ? 0 : $ x;
I know what most its supposed to do (kinda), but just confused about exact syntax of the "?" and ":" notations.
Tried searching PHP.net but couldnt find what I was looking for. Any expect care to point me to a page I can read or explain this to me?
Posted 07 July 2006 - 06:51 AM
Very good video on ternary operators @ vtc.com .. its one of their free php tutorial vids.
Its seem though that these things are good only for echo .. lol .. perhaps its just happens to seem that way because all the example is jsut echo example.
Can I do something like
"(conditional statement) ? function_call(); some_other_functions(); another_function(); : print_error() ;"
instead of just
"(conditional statement) ? 'some text' : 'some other text'; "
Posted 07 July 2006 - 08:11 AM
Posted 07 July 2006 - 08:36 AM
Hey Cook, are your Surname Guo ?
To be a coder, you must learn how to think and not to give up so easily.
Posted 07 July 2006 - 06:41 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users