开发者

PHP bug in if-else-if condition?

开发者 https://www.devze.com 2023-01-27 09:26 出处:网络
For debugging I\'ve entered two echos to an if-else-if section in a method: if ( $options instanceof Zend_Config ) {

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消