Constants and switch statement : define « Math « PHP






Constants and switch statement

 
<?php 
define('ALIGN_LEFT', 1); 
define('ALIGN_CENTER', 2); 
define('ALIGN_RIGHT', 3); 


switch($value) { 
    case ALIGN_LEFT : 
        break; 
    case ALIGN_CENTER : 
        break; 
    case ALIGN_RIGHT : 
        break; 
} 
?>
  
  








Related examples in the same category

1.Constants, like the names of variables, are case-sensitivebut unlike variables
2.Define a constant as an array or object