note 113575 deleted from control-structures.switch by tularis

From: Date: Fri, 01 Nov 2013 09:54:51 +0000
Subject: note 113575 deleted from control-structures.switch by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197377@lists.php.net to get a copy of this message
Note Submitter: dr_kabeza at yahoo dot com ---- Some interesting stuff. // 0-99: OK // Other: ERROR $codigo = (int) '000'; // Results: ERROR switch( $codigo ) { case( $codigo >= 0 AND $codigo < 100 ): echo 'OK'; break; default: echo 'ERROR'; break; } // Results: OK switch( $codigo ) { case 0: case( $codigo > 0 AND $codigo < 100 ): echo 'OK'; break; default: echo 'ERROR'; break; } There's something tricky on how the case deals with the zero evaluation.

« previous php.notes (#197377) next »