©John Samuel 2008 Introduction to PHP. ©John Samuel 2008 Objectives At the end of this class the student will be able to; Create and run a simple php.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
PHP Programming with MySQL Slide 2-1 CHAPTER 2 Getting Started with PHP.
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.
ASP Tutorial. What is ASP? ASP (Active Server Pages) is a Microsoft technology that enables you to make dynamic and interactive web pages. –ASP usually.
PHP (2) – Functions, Arrays, Databases, and sessions.
1 Web Wizards Guide To PHP David Lash Chapter 1 Introduction to PHP.
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
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.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
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.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 03.
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.
Copyright © Curt Hill PhP History and Introduction.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Web Design & Development PHP.
University of Sunderland Lecture 1 Internet Software Architectures Lecture 1: Introduction.
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.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
INTERNET APPLICATION DEVELOPMENT For More visit:
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.
BMC3183 Advance Web Programming Programming Session 2013/2014.
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.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
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.
PHP By Sergio Rodriguez By Sergio Rodriguez. PHP G PHP: Hypertext Preprocessor G Scripting language G PHP: Hypertext Preprocessor G Scripting language.
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.
Lecture Note 1: Getting Started With ASP.  Introduction to ASP  Introduction to ASP An ASP file can contain text, HTML tags and scripts. Scripts in.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
1 PHP Introduction Chapter 1. Syntax and language constructs.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
Strings, output, quotes and comments
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
PHP Workshop ‹#› أطلق إبداعك 2 أطلق إبداعك 2 مدرس معتمد من مركز زووم PHP: The Basics.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
PHP Training Senior Design team Ongo8 Sunday October 16, 2005.
Chap 2 – Getting Started COMP YL Professor Mattos.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Basic Scripting & Variables Yasar Hussain Malik - NISTE.
©John Samuel 2008 Introduction to PHP Note: These slides are not included in coverage for the BIF703 final exam...
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,
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.
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.
PHP using MySQL Database for Web Development (part II)
PHP (PHP: Hypertext Preprocessor)
PHP Introduction.
JavaScript an introduction.
Chapter 2 Getting Started with PHP PHP Programming with MySQL
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
PHP.
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
PHP an introduction.
Presentation transcript:

©John Samuel 2008 Introduction to PHP

©John Samuel 2008 Objectives At the end of this class the student will be able to; Create and run a simple php program using their Zenit account. Explain the basic way in with PHP works. Explain how to add PHP code to an XHTML document.

©John Samuel 2008 Objectives At the end of this class the student will be able to; Write and execute simple PHP programs using the following language features: Comments Variables Arrays and array functions Use php to create simple dynamic XHTML programs.

©John Samuel 2008 Php installation You can run php programs on your Zenit accounts. If you want your own development environment for php, you will need to install a web server first (Apache recommended) and then php. To duplicate the environment on Zenit you will also need to install MySql. Follow the install instructions included with each download carefully.

©John Samuel 2008 Apache installation If you already have another web server installed, (e.g. IIS or PWS) you will need to assign a different port to Apache, by editing httpd.conf.

©John Samuel 2008 Configuration Configuration of php can be done by editing the php.ini file. Read the php documentation and the internal comment in the ini file to make sure that you know what you are changing.

©John Samuel 2008 Configuration asp-style tags are not enabled on zenit. Make sure that any assignment code you write at home will run on zenit. If you wish, you can change your php.ini file so that asp/jsp stype tags are also accepted, i.e. change the following line ; Allow ASP-style tags. asp_tags = Off To ; Allow ASP-style tags. asp_tags = On

©John Samuel 2008 Configuration Allowing asp-style and short open tags on zenit: Create a file named.htaccess in the directory that has your php code. Add the following content: php_flag asp_tags on php_flag short_open_tag on

©John Samuel 2008 Configuration You can test PHP and learn about its settings by using the function phpinfo().

©John Samuel 2008 PHP Stands for Personal HomePage Created by Rasmus Lerdorf for his own use. Latest version 5.x Part of “LAMP” technologies (

©John Samuel 2008 PHP It is extremely easy to learn. Syntax is a mix of C and Perl. PHP is a function-based language. There are thousands of PHP functions for just about any imaginable purpose.

©John Samuel 2008 PHP Start with HTML and add specially marked sections of code. Code is executed, any changes or additions are made to the HTML code, and it is returned to the browser/user agent for ‘display’.

©John Samuel 2008 PHP Any XHTML page can be turned into a PHP page simply by changing the extension to.php

©John Samuel 2008 PHP tags There are 3 (4) ways to mark PHP code inside a document. Note ; at end of each line. Multiple lines allowed between start and end tags. __ML can be included in PHP print statements.

©John Samuel 2008 PHP tags There are 2 shortcuts for including literal or variable data without a print statement, (if short tags enabled) (if asp tags enabled) E.g. Note, no ; after data

©John Samuel 2008 PHP tags When developing PHP code that may be used by others (modules), it is recommended that you use the formal tags since the other forms are configurable and may not be supported on the user’s system.

©John Samuel 2008 Comments Inside the PHP tags, the following comment styles are allowed. Outside the PHP tags, comments must follow the style of the ML (usually ). Single line PHP comments: // # Multiple line PHP comments: /* */

©John Samuel 2008 Comments Note that PHP comment markers only apply inside PHP tags, e.g. this part gets printed

©John Samuel 2008 Variable types There are six types: boolean integer string float objects (beyond scope of course) array Variable capacity is system dependent.

©John Samuel 2008 Casting You can cast in the C style, or use the function settype(). See variables.php

©John Samuel 2008 Variable functions There are many useful functions for working with variables. gettype() returns the type of the variable. There is a boolean function for each type, e.g. is_int($x) returns true if $x is an integer, etc. Can use var_dump() to print details about a value. See variables.php See for a list of variable functions.

©John Samuel 2008 Arrays Can be multidimensional. Can be indexed or associative. Three important keywords are: array list range See arrays.php

©John Samuel 2008 Array functions There are many useful array functions. See arrayfunctions.php See for a complete list.

©John Samuel 2008 “” vs. ‘’ Variables and special characters inside “” are interpolated, but ‘’ are not. Same as in Perl.

©John Samuel 2008 Review What are the PHP comment styles? How does PHP treat variables? What are PHP’s variable types?