1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Introduction to JavaScript
Web Applications in Hatch Radoslav Georgiev Telerik Corporation
IST 221 Internet Concepts and Applications Introduction to PHP.
Website Development Introducing PHP The PHP scripting language Syntax derives from C, Java and Perl Open Source Links to MySql database.
Guide To UNIX Using Linux Third Edition
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Server side basics.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
PHP Workshop ‹#› PHP: The Basics. PHP Workshop ‹#› What is it? PHP is a scripting language commonly used on web servers. –Stands for “PHP: Hypertext Preprocessor”
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Introduction to PHP. PHP PHP is the Hypertext Pre-processor –Script language –Embedded into HTML –Runs as Apache module –Can use DB (MySQL, Oracle, Microsoft.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
PHP MOHAMMED SHURRAB TO MISS/ RASHA ATTALLAH. What is PHP? Stands for "PHP Hypertext Preprocessor" Server-side scripting language HTML-embedded Supports.
PHP == ‘ Hypertext Preprocessor ’ Open-source, server-side scripting language Used to generate dynamic web-pages PHP scripts reside between reserved PHP.
Copyright © Curt Hill PhP History and Introduction.
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
PHP H ypertext P re-processor. Unit 6 - PHP - Hello World! - Data types - Control structures - Operators.
PHP. Why should we learn web programming? No need write socket programming. - You can forget TCP/IP & OSI layers. - Web server handles socket tasks for.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
Nael Alian Introduction to PHP
Writing Web Pages By Shyam Gurram. Agenda Writing Web Pages Delimiting PHP Program Units. Displaying Output to Web Pages Putting Comments in PHP Programs.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
Fall 2004CSI University of Ottawa Introduction to PHP Basic principles and syntax.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
PHP Workshop ‹#› أطلق إبداعك 2 أطلق إبداعك 2 مدرس معتمد من مركز زووم PHP: The Basics.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
Chap 2 – Getting Started COMP YL Professor Mattos.
Fall 2004CSI University of Ottawa Introduction to PHP Basic principles and syntax.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Basic Scripting & Variables Yasar Hussain Malik - NISTE.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
CSE 154 LECTURE 14: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
PHP – PHP Hypertext Processor A quick overview. How is PHP used? Embedded with HTML, e.g. Not like CGI: PHP files not an executable Used with servers.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 13 Scott Marino.
By bscshelp.com 1.  It is a group assignment.  Complete Website design Using Html and Css.  Due date: 10 th December, 2014 (Hard Deadline) 2.
PHP using MySQL Database for Web Development (part II)
PHP for Server-Side Programming
Introduction to PHP Part 1
PHP (PHP: Hypertext Preprocessor)
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
PHP Introduction.
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
PHP: Hypertext Preprocessor
PHP an introduction.
23 PHP.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular. Know the fundamental concepts of Web Scripting Languages in general, PHP in particular. Make simple scripts with PHP: Make simple scripts with PHP: PHP Syntax PHP Syntax PHP Data Types PHP Data Types

2 PHP Intro Processing an HTTP Request 4 Client Browser 1 PHP Module Apache Web Server 23

3 PHP Intro Web Scripting Languages Languages used to create Web pages dynamically, e.g., by using data retrieved from a database: CGI Scripts and Programs CGI Scripts and Programs Perl: Practical Extraction and Report Language Perl: Practical Extraction and Report Language PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor ASP: Server Pages ASP: Active Server Pages JSP: Java Server Pages JSP: Java Server Pages ASP.NET: Visual Basic, C# ASP.NET: Visual Basic, C# Python Python

4 PHP Intro What is PHP? PHP is a scripting language used mostly for creating web pages dynamically. PHP: Hypertext Preprocessor. Originally called Personal Home Page. PHP: Hypertext Preprocessor. Originally called Personal Home Page. PHP is server-side scripting. PHP is server-side scripting. PHP statements can be embedded within an ordinary HTML page with tags. PHP statements can be embedded within an ordinary HTML page with tags. PHP is dynamically typed. PHP is dynamically typed. PHP code is interpreted. PHP code is interpreted.

5 PHP Intro Simple PHP Script Output: = 5 <?php $x = 2; $y = 3; $z = $x + $y; echo “2 + 3 = $z”; ?>

6 PHP Intro Simple PHP Web Script Hello World! <?php echo “Hello World!“; ?> Output: Hello World! Hello World!

7 PHP Intro PHP Syntax Similar to C++ / Java Semi-colon ; is a statement terminator. Semi-colon ; is a statement terminator. Variable names start with $. Variable names start with $. Operators and expressions are similar to those used by C and Java with a few additions. Operators and expressions are similar to those used by C and Java with a few additions. Control structures Control structures if-else, switch, while, do-while, for, foreach, break, continue,...

8 PHP Intro PHP Data types Scalar types: - boolean - integer - float (double) - string Compound types: - array - object Special types: - resource - NULL

9 PHP Intro Variables Are Not Statically Typed $A = 1; $A = “abc”; Since a variable is not statically typed, a value of any type can be assigned to it. The type of a variable can be boolean, integer, float, string, array, object, and resources. NULL also can be assigned.

10 PHP Intro Polymorphism: Automatic Data Type Conversion $A = 1; $B = 2; $C = $A + $B; $D = $A. $B; echo "$C\n"; echo "$D\n"; echo ’$C\n’; Output: 3 12 $C\n

11 PHP Intro Boolean Values echo true; echo false; echo 1; echo 0; echo true ? ‘A’ : ‘B’; echo 1 ? ‘A’ : ‘B’; echo 100 ? ‘A’ : ‘B’; echo ‘xx’ ? ‘A’ : ‘B’; echo false ? ‘A’ : ‘B’; echo 0 ? ‘A’ : ‘B’; echo ‘’ ? ‘A’ : ‘B’; 1(empty)10 AAAABBB

12 PHP Intro Idiosyncrasies echo ‘dog’ = = 0; echo 0 = = 0; echo 0 = = false; echo 0 = = = 0; echo 0 = = = false; echo ‘100’ = = 100; echo ‘100’ = = = 100; echo (int) “100”; echo (int) “100xxx”; echo (int) “xxx100”; 1111(empty)1(empty)

13 PHP Intro Evaluating a Variable within Text Mode Evaluation: $x1 = 100 $x2 = 100 $x3 = 100 Evaluation: <? $x = 100; echo “ \$x1 = ”. $x; echo “ \$x2 = $x\n”; ?> $x3 =

14 PHP Intro Special Characters within “ …” The following special characters can be used within a string quoted by “”: \” -- double quote \” -- double quote \n -- newline \n -- newline \r -- carriage return \r -- carriage return \t -- tab \t -- tab \\ -- backslash \\ -- backslash \$ -- dollar sign \$ -- dollar sign \{, \), \[, \] \{, \), \[, \]

15 PHP Intro Parameter Passing to a Function $a = 10; $b = 20; echo add($a, $b). “\n”; echo $a. “\n”; echo $b. “\n”; function add($x, &$y) { $x++; $y++; return $x + $y; }

16 PHP Intro Including a File An external file can be loaded with one of the following statements: The execution continues even when the file to be The execution continues even when the file to be loaded does not exist. loaded does not exist. The execution terminates when the file to be The execution terminates when the file to be loaded does not exist. loaded does not exist. and and A file is included only once even if it is requested A file is included only once even if it is requested multiple times. multiple times.

17 PHP Intro PHP Resources PHP Website - PHP Website - PHP Manual – Getting Started: PHP Manual – Getting Started: Hugh E. Williams and David Lane. Web Database Applications with PHP & MySQL. O'Reilly, ISBN (optional) Hugh E. Williams and David Lane. Web Database Applications with PHP & MySQL. O'Reilly, ISBN (optional) Other resources on the web Other resources on the web