Is it possible that PHP switch statement does not executes the switch desired result while using return?
What is the difference between these two statements?
$foo = '2';
switch ($foo) {
case 1:
echo 1;
break;
case 2:
echo 2;
break;
}
executes 2
versus
$foo = '2';
switch ($foo) {
case 1:
return 1;
break;
case 2:
return 2;
break;
}
Doesnt seem to work.
is there a way to make it work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…