An introduction to PHP web programming ITWP103.

Slides:



Advertisements
Similar presentations
Quick and Dirty Intro to PHP By David Choffnes (content shamelessly ripped from the manual)
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Software Freedom Day th September 2007 Asia Pacific Institute of Information Technology Colombo, Sri Lanka. Nazly Ahmed Scripting The Web.
BY: ALBERTO CABEZAS 4/19/2010. INTRODUCTION: PHP is considered today as one of the most famous scripting languages. PHP is widely used as a general purpose.
Learning Web development. 3(+1) Tier architecture PHP script Remote services Web Server (Apache, IIS) Browser (IE, FireFox, Opera) Desktop (PC or MAC)
IST 221 Internet Concepts and Applications Introduction to PHP.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Intermediate PHP (1) Data Structures, Functions, Basic OO & Error Handling.
By Brian Patterson & Amanda Perez. PHP was originally created to maintain his personal homepage, hence the name PHP. Development began in 1994 and was.
Scripting Languages and PHP. Origins Rasmus Lerdorf ‘Personal Home Pages’. Zeev Surashi and Andi Gutmans Open Source PHP version 4 Full information on.
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
PHP PHP: Hypertext Preprocessing Matt Murphy & Dublas Portillo.
PHP PHP: Hypertext Preprocessing. What is PHP? PHP is a server-side scripting language designed specifically for the Web. An open source language PHP.
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
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.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
PHP HYPERTEXT: PREPROCESSOR By: Justin T. Pleva. WHAT IS PHP?  General purpose  Server-side web development  Console application.
Powerpoint Templates Page 1 Powerpoint Templates Web Programming PHP MySql Ikbal Jamaludin.
What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled.
PHP - Hypertext Preprocessor Yaron Benita De Paul University.
Copyright © Curt Hill PhP History and Introduction.
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
PHP was created by Rasmus Lerdorf in It was initially server-side, traffic tracking script. PHP 2 (1995) Added database support, file uploads, regular.
PHP Professor Waterman. Agenda What is PHP Versions HTML Dynamic Web sites Interactive Web Sites Installing PHP Transfer pages to a Web hosting service.
INTERNET APPLICATION DEVELOPMENT For More visit:
PHP PHP: Hypertext Preprocessing Preston Brinks and Sean McKenzie.
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
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.
Introduction to PHP and MySQL Kirkwood Center for Continuing Education By Fred McClurg, © Copyright 2015, Fred McClurg, All Rights.
PHP OVERVIEW. C ONTENT Introduction of PHP History and development Basics of PHP programming.
Introduction to CS520/CS596_026 Lecture Two Gordon Tian Fall 2015.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
PHP Teresa Worner. What is it? PHP: Hypertext Preprocessor server-side scripting language open source cross-platform compatible with almost all servers.php.php3.phtml.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
WEB DEVELOPMENT WITH PHP/MYSQL. WEB DEVELOPMENT COURSE HAS DIFFERENT NAME IN DIFFERENT INSITUTES, THIS IS A CORE COURSE FOR BS/MS STUDENTS. THIS IS ALSO.
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.
Yasar Hussain Malik - NISTE. PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key.
Martin Kruliš by Martin Kruliš (v1.1)1.
PHP Introduction PHP is a server-side scripting language.
1 PHP Pattadon Sintusak ID PHP Programmingintroduction2 Content History of PHP What’s PHP? Purpose of PHP Structure of PHP Language Reference.
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.
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,
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.
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.
Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
PHP stands for …….. “PHP Hypertext Pre-processor” and is a server-side scripting language like ASP. PHP scripts are executed on the server PHP supports.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Presented By Sushil K. Chaturvedi Assistant Professor SRCEM,Banmore 1.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
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.
PHP (PHP: Hypertext Preprocessor)
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.
PHP Introduction.
IntroductionToPHP Static vs. Dynamic websites
Intro to PHP.
Introduction to PHP.
Presentation transcript:

An introduction to PHP web programming ITWP103

© 2008, Mike Murach & Associates, Inc. An introduction to PHP web programming Objectives To understand the history of PHP To know the advantages of PHP as a server side scripting language To know what are the software's needed in developing web application using PHP. To run PHP application on a web browser. To know the basic syntax of PHP for outputting to browser. To know the datatypes that are available on PHP and on how these datatypes are being used. To know some predefined type function for data manipulation. To know the proper casting values of a given variables. Murach’s ASP.NET 3.5/C#, C1 © 2008, Mike Murach & Associates, Inc.

HISTORY An introduction to PHP web programming 1994/1995 (PHP 1.0) Developed by Rasmus Lerdorf To know how many visitors were reading his online resume based on PERL/CGI script Personal Home Page (PHP) 1997 (PHP 2.0) PHP is based on C rather than PERL Personal Home Page/Form Interpreter 1998 (PHP 3.0) 50,000 users were using PHP to enhance their Web pages Developers joined Lerdorf 1999 (PHP 4.0) With core developers Zeev Suraski and Andi Gutmans PHP makes the most popular scripting language with morethan one million user base by Netcraff

HISTORY (Con’t.) An introduction to PHP web programming Hundreds of functions being added Dubbed the Zend scripting engine May 22, 2000 (PHP 4.0) PHP: Hypertext Preprocessor (recursive acronym) 3.6 million domain PHP installed Enterprise development Improved resource handling (scalability) Object-oriented support (Classes and Objects) Native session-handling support (session) Encryption (encryption algoritms) ISAPI Support (for IIS) Native COM/DOM (Windows applications) Native Java Support: (binding to java objects) PERL Compatible Regular Expressions New features, power, and scalabilty

HISTORY (Con’t.) An introduction to PHP web programming PHP 5 (July 13, 2004) Vastly improved object-oriented capabilities: OOP improvement Try/catch exception handling Improved XML and Web Services support (Simple XML Support, using SOAP) Native support for SQLite Installed on 19 million domains 54 percent on all Apache module PHP 6 (2007 not yet released) Unicode Support (Native Unicode support for multilingual applications Security improvements New language features and constructs (64-bit type integer, foreach looping) http://en.wikipedia.org/wiki/PHP

HISTORY (Con’t.) An introduction to PHP web programming PHP Key categories Practicality PHP is a loosely type language (no explicitly create, typecast, or destroy a variable) Power More libraries and thousands of functions Possibility Native support is offered for more than 25 database products, including Adabas D, dBase, Empress, FilePro, FrontBase, Hyperwave, IBM DB2, Informix, Ingres, InterBase, mSQL, Microsoft SQL Server, MySQL, Oracle, Ovrimos, PostgreSQL, Solid, Sybase, Unix dbm, and Velocis. Both structured and Object Oriented approach Price Free of charge

Web Architecture An introduction to PHP web programming Page Request html Internet Page Request html scripts database

Software Requirements Operating System: Linux An introduction to PHP web programming Software Requirements Operating System: Linux

Software Requirements Operating System: Windows An introduction to PHP web programming Software Requirements Operating System: Windows

Software Requirements Operating System: Mac An introduction to PHP web programming Software Requirements Operating System: Mac Cheetah Panther Puma Tiger Jaguar Snow leopard Leopard Lion

Software Requirements Internet browser An introduction to PHP web programming Software Requirements Internet browser Opera Mozilla Firefox Safari Internet Explorer Google Chrome Deepnet Explorer Rockmelt Avant Browser Maxthon SeaMonkey

Software Requirements Web Server An introduction to PHP web programming Software Requirements Web Server Apache Google Web Server (GWS)

Software Requirements Server side scripting language An introduction to PHP web programming Software Requirements Server side scripting language Java (JavaServer Pages: JSP) Active Server Pages (ASP) Ruby (Ruby on Rails) Python (Django) PERL CGI

Software Requirements Database An introduction to PHP web programming Software Requirements Database Oracle

Software Requirements Code editor An introduction to PHP web programming Software Requirements Code editor Bluefish Dreamweaver

HTML CSS Software Requirements Other An introduction to PHP web programming Software Requirements Other CSS HTML

Software Requirements Other An introduction to PHP web programming Software Requirements Other Operating System Windows 7 / Windows 8 Web Server Apache Language Script PHP Database MySQL Code Editor Notepad++ / Eclipse / Netbeans / Dreamweaver XAMPP / WAMP

Running PHP Scripts XAMPP Download XAMPP Install XAMPP An introduction to PHP web programming Running PHP Scripts XAMPP Download XAMPP http://www.apachefriends.org/en/xampp.html Install XAMPP Run XAMPP Control c:\xampp (by default) Start the Apache and MySQL(for database) Service Create a folder under c:\xampp\htdocs\ (by default) Note: All php files must be save on that folder Test PHP script sample file. Open some internet browser Type localhost/[folder name] (by default) Select file from the directory list (if there’s

Running PHP Scripts An introduction to PHP web programming All php scripts must enclosed with <?php … ?> (standard tag) <? … ?> (short open tag) <script language=“php”> …. </script> (script tag) <% … %> (asp style tag) OUTPUT:

Running PHP Scripts An introduction to PHP web programming opening tag for php script Statement terminator echo – is a language construct that use to output one or more string. print – is a function also use for outputting strings. closing tag for php script

An introduction to PHP web programming PHP Comments

PHP Variables An introduction to PHP web programming Variables are used as a container for values that can be used and manipulate PHP scripts. Variables in PHP must begin with a $ symbol. Variable might contain a string, numbers, arrays and objects. Setting the identifier for a variable must follow some rules. First character can be ‘_’ or a letter. It can only contain alpha-numeric characters and underscore (a-z,A-Z,0-9,_). Don’t use white space in naming a variable. Variables in PHP is not explicitly declared Variables are case sensitive Example $age, $firstName, $totalSalary, $_myValue, $str1, $tmp01

An introduction to PHP web programming Using ‘ ‘ (pair single quote), “ “ (pair double quotes) and . (dot character) PHP Strings inside the ‘ and ‘ are interpreted as literal strings To display a ‘ character (single quote) as string use the escape character \ (backslash). Strings inside the “ and “ are interpreted as literal strings with some exceptions $ inside “ and “ are interpreted as variables thus it will display the value rather than the string that starts with $. To display the string that starts with $ and to display the double quote as string use the escape character \ (backslash). To concatenate string values use the . (dot or period) character thus “abc“.”def” yields to a value “abcdef”

An introduction to PHP web programming Using ‘ ‘ (pair single quote), “ “ (pair double quotes) and . (dot character) PHP Example: Output:

Outputting Data An introduction to PHP web programming echo syntax void echo(string argument1[,…string argumentN] print syntax int print(argument) printf syntax boolean printf(string format [, mixed args])

Outputting Data An introduction to PHP web programming Example:

Commonly Used Type Specifiers for printf function An introduction to PHP web programming Commonly Used Type Specifiers for printf function Beginning PHP and MySQL 3rd Edition by: W. Jason Gilmore pp.100

PHP Datatypes Datatypes An introduction to PHP web programming PHP Datatypes Datatypes is the generic name assigned to any data sharing a common set of characteristics. Scalar Datatypes Capable of containing a single item of information (Boolean, Integer, Float (float, double or real numbers), String) Compound Datatypes allow for multiple items of the same type to be aggregated under a single representative entity. (Array and Objects)

An introduction to PHP web programming Scalar Datatypes Eample:

Compound Datatypes An introduction to PHP web programming Example: Output: Output:

PHP Type Casting Operators An introduction to PHP web programming PHP Type Casting Operators Beginning PHP and MySQL 3rd Edition by: W. Jason Gilmore pp.105

PHP Type Casting Operators An introduction to PHP web programming PHP Type Casting Operators Example: Output:

PHP Type Juggling An introduction to PHP web programming Example: Output:

Predefined Type Functions An introduction to PHP web programming Predefined Type Functions gettype() function returns the type of the variable. Possible return values are integer, double, boolean, string, array, object, resource, unknown types. prototype: string gettype(mixed var) settype() function converts a given variable to a specific type. boolean settype(mixed var, string type) Predefined Type Identifier Functions is_array(), is_bool(), is_float(), is_integer(), is_null(), is_numeric(), is_object(), is_resource(), is_scalar(), and is_string()

An introduction to PHP web programming Type Functions Example: Output:

Summary An introduction to PHP web programming PHP was developed originally by Rasmus Lerdorf Seev Suraski and Andi Gutsman were the one who contribute most in PHP development. PHP key categories are practicality, power, possibility, and price. PHP is a embedded language that is commonly embedded on HTML PHP is a server-side scripting language that runs its application on a Web server. Much of the PHP syntax were derive from C programming Language. You can integrate database easily in PHP. Standard PHP script are enclosed by <?php and ?> tags. Each statement in PHP must be terminated with a semi-colon(;). All variable in PHP must have a dollar ($) character before its identifier.

Summary (Continue) An introduction to PHP web programming PHP variables are not explicitly declared. You can use echo, print, or printf function for outputting strings to internet browser. You can enclosed string using a pair of single quote or pair of double quote. String inside a pair of single quote interpreted as literal except for the single quote itself. String inside a pair of double quote interpreted as literal with some exception like using dollar character. To explicitly display the character on the internet browser use backslash (\) character like \$, \’, \” and etc. Datatypes in PHP can be categorized as scalar or compound datatypes. You can explicitly change the type of a variable in PHP. PHP support some predefined type function that can be used in manipulating type variables.

REFERENCE An introduction to PHP web programming Beginning PHP and MySQL from Novice to Professional, 3rd Edition (2008) PHP 6 and MySQL 5 for Dynamic Web Sites by: Larry Ullman (2008) PHP Solutions Dynamic Web Design Made Easy by: David Powers (2010) PHP 6/MySQL Programming for the absolute beginner by: Andi Harris (2009) PHP & MySQL Web Development for Dummies by: Janet Valade (2008) http://php.net/manual/en/