php question...
php question...
- Started
- Last post
- 4 Responses
- jgjh151
I can't seem to find any documentation on the use of the true/false format like this:
? true : false;
As in something like this:
$config[db_error] = (!$config[db_link]) ? true : false;
Know where any docs are or can you explain why you would right it like this.
Thanks!
- enobrev0
it's really just another way of doing things...
A way to make a conditional var in one line.
Personally, I don't use them much because they can be confusing to read.
It's the direct equivalent to
if ( conditional ) {
$var = 'whatever';
} else {
$var = "whatever else';
}
- jgjh1510
Perfect, thanks. I just found another piece of code that got me going the right direction, then this definatly confirms it.
Thanks!
- ********0