10-29-2009, 06:02 AM
|
#1 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Nested Ternary = Fail
Hmm. It's times like this that the coffee isn't fixing my problem, so I'm going to post in Absolute Beginners.
Can somebody spot the error in this nested ternary that I'm missing (and don't say the error is using a ternary, I'll poke you in the eye)? The preceding operation is there as a test and produces the desired result. The nested version is producing a fail. Fail!
php Code:
echo isset( $one[ $i][ 'timestamp'] ) ? $one[ $i][ 'timestamp'] : 'fail'; echo ' :: '; $timestamp = isset( $one[ $i][ 'timestamp'] ) ? $one[ $i][ 'timestamp'] : isset( $two[ $i][ 'timestamp'] ) ? $two[ $i][ 'timestamp'] : isset( $three[ $i][ 'timestamp'] ) ? $three[ $i][ 'timestamp'] : 'fail'; die( $timestamp );
|
|
|
|