Speaker: Hsiang-Ting Fang 1
What is PHP. History of PHP. Variables Data type Examples*4 Reference Exercise*3 2
PHP: Hypertext Preprocessor. Scripting language. Can be embedded into HyperText Markup Language ( HTML). Server-client structure. 3 [1]
PHP/FI Created by Rasmus Lerdorf in 1995 Personal Home Page Tools Perl script PHP2 PHP: Hypertext Preprocessor C language 4
Must start with “$”. Other name rules are the same as C. External variable GET/POST COOKIE SESSION Internal variable phpinfo(); phpinfo(); SERVER 5
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 ();
<?php /* Edited by Claudia July 21, 2011 */ $tmp = "Hello world!" ; //This is a string echo $tmp ; #print the variable ?> 7
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
php Hello World! \n"; ?> 9
Template: Code:
[1]
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