Ean ypo8esoume pos exoume ton parakatw kwdika:
switch ($Age)
{
case $Age <= 18:
echo "$Msg1";
break;
case $Age > 18 && $Age < 30:
echo "$Msg2";
break;
default:
echo "$Msg0";
}
Mporei kapoios na mou pei giati den trexei kanonika?
ANALYSI:
1) Trexei kanwnika otan vazw age katw ton 18! Emfanizei kanonika to minima!
2) Otan vazw omos age metaxi 19-30 tote apla den trexei kai emfanizei to default minima. GIATI???!!!
Den dexete dio sigkrisis h entoli case?
3) Na simiothi oti o apache, kai i php einai kanonika egkatestimenes kai oles oi ales entoles trexoyn kai litourgoun apsoga sto sistima mou (Win98 Eng)
Plz! Tis fteei?
An kai den exo idea apo php mou fainetai logiki idea na ftaiei kapoia metavliti (stin prokeimeni periptosi to 18 kai to 30). Giati den vazeis allon arithmo? Opou vlepeis as poume 18 vale 50 kai opou as poume vlepeis 30 vale 100. Logika tha piasei...
Εδώ case $Age > 18 && $Age < 30: δώσε case $Age > 19 && $Age < 30:
Oxi paidia. Euxaristw gia tis apantisis alla to vrika to provlima.
Apla i entoli case den ypostirizi tin sigrisi metaxi dyo i perisoterwn timon. Einai apoliti. I metavliti kai i timi tis dilononte ston Switch($Variable) kai meta apla sigrinis...
case $Variable=1
.....
case $Variable=2
.....
case $Variable=3
.....
H entoli
case $Variable>1 && $Variable<2
den einai simvati.
Euxaristw omos osa paidia apantisan ;-)
tip: Οι αρνητικές ιδέες δεν θα οδηγήσουν ποτέ σε θετικές πράξεις . * F5 για νέο tip