Download presentation
Presentation is loading. Please wait.
Published byKevin Griffith Modified over 8 years ago
1
PHP 1 12 123 1234 12345 http://www.thaiall.com/php/training49.htm http://www.thaiall.com/article/teachpro.htm Update : August 23,2012
2
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
3
This source code in x.php was not the answer 1234512345
4
<? echo " 1 2 3 4 5 "; ?>
5
ok <? echo " 1 2 3 4 5 "; ?>
6
ok 1 2 3 4 5
7
ok 1 2 3 4 5
8
no <? echo "1"; echo "2"; echo "3"; echo '4'; echo '5'; ?>
9
ok <? echo "1 "; echo "2 "; echo "3 "; echo '4 '; echo '5 '; ?>
10
no <? echo "1\n"; echo "2\n"; echo "3\n"; echo '4\n'; echo '5\n'; ?>
11
ok <? echo " 1\n 2\n 3\n 4\n 5\n "; ?>
12
ok <? echo "1\n2\n3\n4\n5\n"; ?>
13
ok "; ?>
14
no.. It was not error and warning If you do not declare <? echo $i++." "; ?>
15
ok <? for($i=1;$i<=5;$i++) echo "$i\n"; ?>
16
ok <? for($i=1;$i "; ?>
17
ok <? for($i=1;$i "; ?>
18
no <? for($i=1;$i<5;$i++) { echo "$i "; } ?>
19
ok "; ?>
20
ok
21
ok
22
ok
23
ok <? for ($i=49;$i<54;$i++) echo chr($i).chr(10); ?>
24
ok <? $s ="12345"; for($i=0;$i "; ?>
25
ok <? foreach (range(1,5) as $x) { echo "$x "; } ?>
26
ok <? $a = array(1,2,3,4,5); foreach ($a as $x) { echo "$x "; } ?>
27
no <? $i = 0; while ($i <= 5) { echo $i; echo " "; $i = $i + 1; } ?>
28
ok <? $i = 1; while ($i "; ?>
29
ok <? $i = 1; while ($i <= 5) { echo $i++." "; } ?>
30
ok "; ?>
31
no <? while (true) { if ($i >= 5) break; else print $i++. " "; } ?>
32
no <? $s = "1,2,3,4,5"; $a = explode( ',', $s); $i=1; do { echo $a[$i++]." "; } while ($i < 5); ?>
33
no <? do { echo $i++." "; } while ($i < 5); ?>
34
ok <? do { echo $i++." "; if($i > 5) break; } while (true); ?>
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.