Malcolm Beck´s: unelegantes switch

Beitrag lesen

مرحبا

Geht doch auch ohne.

und Anonym geht's auch ;)

$switch = function ($key) {  
    switch ($key) {  
      case 1:  
          return printf('Key: %s', $key);  
      case 2:  
          return printf('Key: %s', $key);  
      case 3:  
          return printf('Key: %s', $key);  
    }  
};  
  
#  
$switch(isset($_GET['var']) ? $_GET['var'] : 1 );

mfg