“PHP Switch Case Array” Code-Antworten

PHP -Schalter

$age=20;
switch ($age) {
	case 19:
        echo "Age is 18";
        break;
    case 20:
        echo "Age is 20";
        break;
    case 21:
        echo "Age is 21";
        break;
}
Grepper

PHP wechseln

switch ($element) {
    case 0:
        echo "i es igual a 0";
        break;
    case 1:
        echo "i es igual a 1";
        break;
    case 2:
        echo "i es igual a 2";
        break;
}
CharllierJr

PHP Switch Case Array

foreach ($array[0] as $key => $value) {
    switch ($key) {
        case 'Products' :
            // do something
            break ;
        case 'customers' :
            // do something
            break ;
        case 'Models' :
            // do something
            break ;
     }
 }
Grevil

PHP Switch Anweisung

<?php
$favcolor = "red";

switch ($favcolor) {
  case "red":
    echo "Your favorite color is red!";
    break;
  case "blue":
    echo "Your favorite color is blue!";
    break;
  case "green":
    echo "Your favorite color is green!";
    break;
  default:
    echo "Your favorite color is neither red, blue, nor green!";
}
?>
naly moslih

Ähnliche Antworten wie “PHP Switch Case Array”

Fragen ähnlich wie “PHP Switch Case Array”

Weitere verwandte Antworten zu “PHP Switch Case Array” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen