note 38890 added to control-structures.switch

From: Date: Sat, 10 Jan 2004 10:32:20 +0000
Subject: note 38890 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-63248@lists.php.net to get a copy of this message
Regarding bishop's comment below, although using: switch($bug === 0 ? '' : $bug) { may work, ( and although I do like the ternary operator, :) it might be more intuitive/readable to use this instead: switch( (string)$bug ) { which typecasts the variable to a string to ensure that "0" will be handled correctly. ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38890 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38890&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38890&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63248) next »