Presentation is loading. Please wait.

Presentation is loading. Please wait.

Speaker: Hsiang-Ting Fang 1. What is PHP. History of PHP. Variables Data type Examples*4 Reference Exercise*3 2.

Similar presentations


Presentation on theme: "Speaker: Hsiang-Ting Fang 1. What is PHP. History of PHP. Variables Data type Examples*4 Reference Exercise*3 2."— Presentation transcript:

1 Speaker: Hsiang-Ting Fang 1

2 What is PHP. History of PHP. Variables Data type Examples*4 Reference Exercise*3 2

3 PHP: Hypertext Preprocessor. Scripting language. Can be embedded into HyperText Markup Language ( HTML). Server-client structure. 3 [1]

4 PHP/FI  Created by Rasmus Lerdorf in 1995  Personal Home Page Tools  Perl script PHP2  PHP: Hypertext Preprocessor  C language 4

5 Must start with “$”. Other name rules are the same as C. External variable  GET/POST  COOKIE  SESSION Internal variable  phpinfo(); phpinfo();  SERVER 5

6 Support these data type 6 Data type How to use Integer$a = 123; $a = 0123; // Octal $a = 0x12; // Hex Float$a = 1.234; $a = 1.2e3; Array$b[0][] = 567.8; $c = array(9, 10, 'A'); String$a = ‘Hello World.’; $a = “Hello world!” ; Objectclass foo { function do_foo () { echo “Doing foo.”; } } $bar = new foo; $bar -> do_foo ();

7 http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example1.php <?php /* Edited by Claudia July 21, 2011 */ $tmp = "Hello world!" ; //This is a string echo $tmp ; #print the variable ?> 7

8 http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example2. php <?php $an1 = "dog"; $an2 = "cat"; $an3 = "bird"; echo "What I like is a $an3. "; echo 'What I like is a $an3. ' ; echo $an1." hates ". $an2."." ; ?> 8

9 http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example3. php Hello World! \n"; ?> 9

10 Template: http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example4.php http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example4.php Code: http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example4.txt http://voip.com.ncnu.edu.tw/Summer2011/PHP/ex/example4.txt 0 1 2 3 4 5 6 7 8 9 10

11 [1] http://chensh.loxa.edu.tw/php/A_1.php http://chensh.loxa.edu.tw/php/A_1.php http://www.php.net/ http://www.lideshare.net/appleboy/php-mysql- 2255172 http://www.lideshare.net/appleboy/php-mysql- 2255172 http://zh.wikipedia.org/wiki/PHP 11

12 What is the difference between POST and GET.( Example4)Example4 Show the 9*9 multiplication table like this link.link Using PHP and from to find out the greatest common divisor. linkfromlink 12


Download ppt "Speaker: Hsiang-Ting Fang 1. What is PHP. History of PHP. Variables Data type Examples*4 Reference Exercise*3 2."

Similar presentations


Ads by Google