mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
48 lines
520 B
PHP
48 lines
520 B
PHP
--TEST--
|
|
Alternative syntaxes test
|
|
--FILE--
|
|
<?php
|
|
$a = 1;
|
|
|
|
echo "If: ";
|
|
if ($a) echo 1; else echo 0;
|
|
if ($a):
|
|
echo 1;
|
|
else:
|
|
echo 0;
|
|
endif;
|
|
|
|
echo "\nWhile: ";
|
|
while ($a<5) echo $a++;
|
|
while ($a<9):
|
|
echo ++$a;
|
|
endwhile;
|
|
|
|
echo "\nFor: ";
|
|
for($a=0;$a<5;$a++) echo $a;
|
|
for($a=0;$a<5;$a++):
|
|
echo $a;
|
|
endfor;
|
|
|
|
echo "\nSwitch: ";
|
|
switch ($a):
|
|
case 0;
|
|
echo 0;
|
|
break;
|
|
case 5:
|
|
echo 1;
|
|
break;
|
|
default;
|
|
echo 0;
|
|
break;
|
|
endswitch;
|
|
?>
|
|
|
|
===DONE===
|
|
--EXPECT--
|
|
If: 11
|
|
While: 12346789
|
|
For: 0123401234
|
|
Switch: 1
|
|
===DONE===
|