You are on page 1of 33

PHP

My case was in Foxserv Server Suit


1. http://sourceforge.net/projects/foxserv/
[FoxServ3.1Beta1.exe]
2. Change [foxserv] in httpd.conf to [easyserv]
3. Press Go for PHP 4.2.2 and Apache 1.3.27
4. Root in C:\FoxServ\www
5. http://127.0.0.1/x.php
Question
How do you write 1 5 in separate lines?
Remark
One to five in x.php
On webserver that support PHP Language

This source code in x.php was not the answer


1
2
3
4
5

This source code in x.php was not the answer


<?
echo "
1
2
3
4
5
";
?>

ok
<pre><?
echo "
1
2
3
4
5
";
?></pre>

ok
1<br>2<br>3<br>4<br>5

ok
<pre>
1
2
3
4
5
</pre>

no
<?
echo
echo
echo
echo
echo
?>

"1";
"2";
"3";
'4';
'5';

ok
<?
echo
echo
echo
echo
echo
?>

"1<br>";
"2<br>";
"3<br>";
'4<br>';
'5<br>';

no
<pre><?
echo "1\n";
echo "2\n";
echo "3\n";
echo '4\n';
echo '5\n';
?></pre>

ok
<pre><?
echo "
1\n
2\n
3\n
4\n
5\n
";
?></pre>

ok
<pre><?
echo "1\n2\n3\n4\n5\n";
?></pre>

ok
<?
<?
<?
<?
<?

echo
echo
echo
echo
echo

++$i
++$i
++$i
++$i
++$i

.
.
.
.
.

"<br>";
"<br>";
"<br>";
"<br>";
"<br>";

?>
?>
?>
?>
?>

no .. It was not error and warning If you do not declare


<?
echo
echo
echo
echo
echo
?>

$i++."<br>";
$i++."<br>";
$i++."<br>";
$i++."<br>";
$i++."<br>";

ok
<pre><?
for($i=1;$i<=5;$i++) echo "$i\n";
?></pre>

ok
<ol><?
for($i=1;$i<=5;$i++) echo "<li>";
?></ol>

ok
<?
for($i=1;$i<=5;$i++) echo "$i<br>";
?>

no
<?
for($i=1;$i<5;$i++) {
echo "$i<br>";
}
?>

ok
<? for($i=1;$i<=5;$i++) { ?>
<? echo "$i<br>"; ?>
<? } ?>

ok
<? for($i=1;$i<=5;$i++) { ?>
<? echo "$i"; ?>
<br>
<? } ?>

ok
<? for($i=1;$i<=5;$i++) { ?>
<?=$i?>
<br>
<? } ?>

ok
<pre>
<? for($i=1;$i<=5;$i++) { ?>
<?=$i."\n";?>
<? } ?>
</pre>

ok
<pre><?
for ($i=49;$i<54;$i++) echo chr($i).chr(10);
?></pre>

ok
<?
$s ="12345";
for($i=0;$i<5;$i++) echo substr($s,$i,1)."<br>";
?>

ok
<?
foreach (range(1,5) as $x) {
echo "$x<br>";
}
?>

ok
<?
$a = array(1,2,3,4,5);
foreach ($a as $x) {
echo "$x<br>";
}
?>

no
<?
$i = 0;
while ($i <= 5) {
echo $i;
echo "<br>";
$i = $i + 1;
}
?>

ok
<?
$i = 1;
while ($i <= 5) echo $i++ ."<br>";
?>

ok
<?
$i = 1;
while ($i <= 5) {
echo $i++ ."<br>";
}
?>

ok
<?
<?
<?
<?
<?
<?

$i = 1; ?>
while ($i <= 5) { ?>
echo $i; ?>
echo "<br>"; ?>
$i = $i + 1; ?>
} ?>

no
<?
while (true) {
if ($i >= 5) break; else print $i++ . "<br>";
}
?>

no
<?
$s = "1,2,3,4,5";
$a = explode( ',', $s);
$i=1;
do {
echo $a[$i++]."<br>";
} while ($i < 5);
?>

no
<?
do {
echo $i++."<br>";
} while ($i < 5);
?>

ok
<?
do {
echo $i++."<br>";
if($i > 5) break;
} while (true);
?>

You might also like