PHP bug in if-else-if condition?
For debugging I've entered two echos to an if-else-if section in a method:
if ( $options instanceof Zend_Config ) {
$options = $options->toArray();
echo "1st condition true<br>";
} else if ( ! is_array($options) ) {
echo "2nd condition true<br>";
exit();
throw n开发者_开发百科ew Bvb_Grid_Exception('options must be an instance from Zend_Config or an array');
}
The crazy thing is the output I'm getting is:
1st condition true
2nd condition true
Can you explain this?!?!
The only explanation is that you are calling that routine twice.
The problem doesn't come from that piece of code you posted. It's something else.
精彩评论