Web Programming with PHP (1)

Slides:



Advertisements
Similar presentations
Lecture 11 Server Side Interaction
Advertisements

Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
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)
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.
Scripting Languages and PHP. Origins Rasmus Lerdorf ‘Personal Home Pages’. Zeev Surashi and Andi Gutmans Open Source PHP version 4 Full information on.
Russell Taylor Lecturer in Computing & Business Studies.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
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.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
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).
Web Programming with PHP (1). -Computer programming (often shortened to programming or coding) is the process of writing, testing, debugging/troubleshooting,
An Introduction to Web Technologies Ankit Jain 4 th Year, Computer Engg Head – DCETECH.COM.
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.
PHP: Hypertext Processor Fred Durao
UFCEKG-20-2 Data, Schemas & Applications Lecture 4 Server Side Scripting & PHP.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Introduction to PHP (1) Background, Data Types, Control Structures & Functions.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
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.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
1 3. Computing System Fundamentals 3.1 Language Translators.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
Yasar Hussain Malik - NISTE. PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
UFCE8V-20-3 Information Systems Development 3 PHP (1) : Data Types, Control Structures, Data Structures, String Handling & Input/Output.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 13 Scott Marino.
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.
Web Database Programming Using PHP
Module 1 Introduction to JavaScript
Web Technologies Computing Science Thompson Rivers University
Unit M Programming Web Pages with
Chapter 5 Scripting Language
CSC 301 Web Programming Charles Frank.
Web Database Programming Using PHP
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 “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Chapter 5 Scripting Language
PHP / MySQL Introduction
PHP Introduction.
JavaScript an introduction.
Web Systems Development (CSC-215)
Introduction to Python
Web DB Programming: PHP
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
IntroductionToPHP Static vs. Dynamic websites
Intro to PHP.
Tonga Institute of Higher Education IT 141: Information Systems
JavaScript CS 4640 Programming Languages for Web Applications
Tonga Institute of Higher Education IT 141: Information Systems
An Introduction to JavaScript
Web Technologies Computing Science Thompson Rivers University
Web Application Development Using PHP
Presentation transcript:

Web Programming with PHP (1)

Pre-amble (1) What is programming? Computer programming (often shortened to programming or coding) is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs. This source code is written in a programming language. The code may be a modification of an existing source or something completely new. The purpose of programming is to create a program that exhibits a certain desired behaviour (customization). The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. (Wikipedia) Structured programming can be seen as a subset or sub-discipline of procedural programming, one of the major programming paradigms. It is most famous for removing or reducing reliance on the GOTO statement. At a low level, structured programs are often composed of simple, hierarchical program flow structures. These are made up of instructions that often equate to a sequence or a selection or a repetition (iteration)

Pre-amble (2) Jackson Structured Programming - an example of a structuring technique or methodology is Jackson Structured Programming (JSP) developed in the 1970’s by Michael Jackson - based on correspondences between data stream structure and program structure, JSP structures programs and data in terms of sequences, iterations and selections an example of a JSP diagram:

Pre-amble (3) Programming paradigms a programming paradigm is a fundamental style of computer programming. (Compare with a methodology, which is a style of solving specific software engineering problems). Paradigms differ in the concepts and abstractions used to represent the elements of a program (such as objects, functions, variables, constraints, etc.) and the steps that compose a computation (assignation, evaluation, continuations, data flows, etc.). paradigms include - procedural programming, functional programming, object-oriented programming, event-driven programming, process-oriented programming, logic-oriented programming etc. some languages (e.g. ruby, xslt) are oriented towards certain paradigms (oo, functional) and some languages (php) can support multiple paradigms (procedural, oo, functional) though it is usually thought of as a procedural language.

Pre-amble (4) Remembering the Web (1) 1993

Pre-amble (5) Remembering the Web (2) Basic web 1.0 architecture & communication

3-tier architecture voice DHTML HTTP SQL touch Browser (IE, FireFox, Opera) PHP script Database Web Server (Apache, IIS) Database Server vision HTML tables Desktop (PC or MAC) Web Service Remote services

http request/response cycle

Pre-amble (6) stuff you (already) need to know Basic html, css & javascript basic html recognize and write basic xhtml - the common tags? - common form layout and data-types? - well-formed? - doctype declaration? basic css recognize and write basic css basic css syntax? the notions of external/embedded/inline styles? - the basic idea behind the document object model (dom)? basic javascript recognize basic javascript syntax? - know in what situations and tasks javascript is a useful technology?

PHP Origins Originally created by Rasmus Lerdorf (born Greenland, educated in Canada) around 1995 PHP originally abbreviated as ‘Personal Home Pages’, now known as ‘PHP Hypertext Preprocessor’ Other key developers: Zeev Surashi and Andi Gutmans (Israel) responsible for PHP 3.0 - a complete re-write of the original PHP/F1 engine (1997) PHP is Open Source software First version PHP/FI released 1995 PHP 5.0 released July 2004 Current version is 5.3.0 PHP version 5.2.4 current at UWE PHP Version 6 due for release late 2009 / early 2010

Scripting languages A scripting language is: often evolved not designed cross-platform since interpreter is easy to port designed to support a specific task – PHP Web support un-typed variables (but values are typed) implicit variable declaration implicit type conversion stored only as script files compiled on demand may run on the server (PHP, Perl) or the client (Javascript) What are the potential differences in programming using an interpreted scripting language like PHP in place of a compiled language (e.g. Java in JSP, .NET)?

PHP details Procedural language C-like syntax - { } ; Compare with Javascript which is event-driven C-like syntax - { } ; Extensive Function Library Good Web-server integration Script embedded in HTML Easy access to form data and output of HTML pages Not fully (compulsorily) object-oriented Java is fully object oriented – all functions have to be in a class In PHP, classes are additional but quite simple to use

PHP and HTML HTML-embedded PHP scripts are essentially HTML pages with the occasional section of PHP script. PHP script is enclosed in the tag pair: <?php print date(“H:i”) ?> 23:18

C-like language Free format - white space is ignored Statements are terminated by semi-colon ; Statements grouped by { … } Comments begin with // or a set of comments /* */ Assignment is ‘=’: $a=6 Relational operators are ,< , > == ( not a single equal) Control structures include if (cond) {..} else { }, while (cond) { .. } , for(startcond; increment; endcond) { } Arrays are accessed with [ ] - $x[4] is the 5th element of the array $x – indexes start at 0 Associative Arrays (hash array in Perl, dictionary in Java) are accessed in the same way: $y[“fred”] Functions are called with the name followed by arguments in a fixed order enclosed in ( ) : substr(“fred”,0,2) Case sensitive - $fred is a different variable to $FRED

Function library (700+) Basic tasks And more specific functions for- String Handling Mathematics – random numbers, trig functions.. Regular Expressions Date and time handling File Input and Output And more specific functions for- Database interaction – MySQL, Oracle, Postgres, Sybase, MSSQL .. Encryption Text translation Spell-checking Image creation XML

String Handling String literals (constants) enclosed in double quotes “ ” or single quotes ‘ ’ Within “”, variables are replaced by their value: – called variable interpolation. “My name is $name, I think” Within single quoted strings, interpolation doesn’t occur Strings are concatenated (joined end to end) with the dot operator “key”.”board” == “keyboard” Standard functions exist: strlen(), substr() etc Values of other types can be easily converted to and from strings – numbers implicitly converted to strings in a string context. Regular expressions be used for complex pattern matching.

Learning PHP Start with just the basics, installing a script to output an HTML page Understand how PHP supports interaction with the Browser or other clients Understand how PHP supports integration with databases – MySQL Understand how PHP supports integration with other applications – Web services

PHP Resources hand out : - php home : http://www.php.net learning PHP : php @ w3 schools code and examples : php extension & application library (pear) : http://pear.php.net/ resource index : http://php.resourceindex.com/ weberdev : http://www.weberdev.com/ArticlesSearch/Category/Beginner+Guides phpexample : http://phpexamples.me/