note 119854 deleted from control-structures.switch by cmb

From: Date: Sun, 21 Apr 2019 11:45:23 +0000
Subject: note 119854 deleted from control-structures.switch by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210631@lists.php.net to get a copy of this message
Note Submitter: Bill ---- Note the case statement does not have to compare with the switch statement. I sometimes use the switch statement to make complex logic more readable: <?php define('TRACK_CPI', true); define('TRACK_INV', true); define('PREFER_CPI_OVER_SINV', false); . . switch (1) { case (TRACK_CPI and PREFER_CPI_OVER_SINV and ($data_row['CPI_id'] != 0)): { . . break; } case (TRACK_CPI and (!PREFER_CPI_OVER_SINV) and ($data_row['SInv_id'] != 0)): { . . break; } case (TRACK_CPI and ($data_row['CPI_id'] != 0)): { . . break; } case (TRACK_INV and $data_row['SInv_id'] != 0): { . . break; } } ?> Hope this helps.

« previous php.notes (#210631) next »