user522350
user522350

Reputation: 13

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 new 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?!?!

Upvotes: 0

Views: 554

Answers (1)

netcoder
netcoder

Reputation: 67705

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.

Upvotes: 7

Related Questions