PHP By Sergio Rodriguez By Sergio Rodriguez. PHP G PHP: Hypertext Preprocessor G Scripting language G PHP: Hypertext Preprocessor G Scripting language.

Slides:



Advertisements
Similar presentations
Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Advertisements

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.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
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.
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”
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
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 Overview CS PHP PHP = PHP: Hypertext Preprocessor Server-side scripting language that may be embedded into HTML One goal is to get PHP files.
PHP - Hypertext Preprocessor Yaron Benita De Paul University.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Copyright © Curt Hill PhP History and Introduction.
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
PHP H ypertext P re-processor. Unit 6 - PHP - Hello World! - Data types - Control structures - Operators.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
An Introduction to PHP The University of Tennessee at Chattanooga C. Daniel Chase “An introduction to basic PHP use with a focus on the power of dynamic.
COP 3813 Intro to Internet Computing Prof. Roy Levow PHP.
Input & Output: Console
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.
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.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
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.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
PHP OVERVIEW. C ONTENT Introduction of PHP History and development Basics of PHP programming.
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.
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.
PHP PHP: Hypertext Preprocesor Personal Home Page Tools.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
PHP Arūnas Liuiza. PHP 101 What is PHP? Widely popular dynamic interpreted opensource programming language, aimed for web development Syntax is simmilar.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 16: PHP Types.
Comments in PHP In PHP, we use // to make a singleline comment or /* and */ to make a large comment block. Comment is a part of your PHP code that will.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
1 PHP Introduction Chapter 1. Syntax and language constructs.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
©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.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Chapter 4 Literals, Variables and Constants. #Page2 4.1 Literals Any numeric literal starting with 0x specifies that the following is a hexadecimal value.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Martin Kruliš by Martin Kruliš (v1.1)1.
PHP Workshop ‹#› أطلق إبداعك 2 أطلق إبداعك 2 مدرس معتمد من مركز زووم PHP: The Basics.
PHP OVERVIEW. C ONTENT Introduction of PHP History and development Basics of PHP programming.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
 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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Intro to PHP More About PHP. So far we've covered... Web Servers & Protocols Presentation Layer (static pages) For the rest of the semester... Application.
©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.
ITM © Port, KazmanVariables - 1 ITM 352 Data types, Variables Class #4.
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,
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.
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.
Radoslav Georgiev Telerik Corporation
PHP Programming Language. PHP is a server-side scripting language designed for web development but also used as a general- purpose programming language.
PHP using MySQL Database for Web Development (part II)
Introduction to PHP Part 1
Documentation Need to have documentation in all programs
PHP (PHP: Hypertext Preprocessor)
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
PHP.
Introduction to Primitive Data types
Introduction to Primitive Data types
Presentation transcript:

PHP By Sergio Rodriguez By Sergio Rodriguez

PHP G PHP: Hypertext Preprocessor G Scripting language G PHP: Hypertext Preprocessor G Scripting language

History G Written by Rasmus Lerdorf  Zeev Suraski and Andi Gutmans  Rewrote parser  PHP 2 G Written by Rasmus Lerdorf  Zeev Suraski and Andi Gutmans  Rewrote parser  PHP 2

History G PHP 3 G PHP 4 G Still being developed G Version Oct G PHP 5 G PHP 3 G PHP 4 G Still being developed G Version Oct G PHP 5

Usage G Server-side Scripting G Web development G Command-line Scripting G Shell scripting G Client-side GUI Apps G Not very common G Server-side Scripting G Web development G Command-line Scripting G Shell scripting G Client-side GUI Apps G Not very common

Server-side Scripting G Main use G Code embedded in HTML to create dynamic web pages G LAMP Architecture G Advantage over others…$$$ …but first! G Main use G Code embedded in HTML to create dynamic web pages G LAMP Architecture G Advantage over others…$$$ …but first!

Syntax G Advantage: Similar to high level PL’s we are familiar with G PHP code goes between tags G G Features that make it different G Advantage: Similar to high level PL’s we are familiar with G PHP code goes between tags G G Features that make it different

Syntax G Embedding HTML in PHP control structures G Will output anything between ?> and the next <?php tags G Embedding HTML in PHP control structures G Will output anything between ?> and the next <?php tags

Types G Type is not explicitly set for variable by programmer G Type of variable is “juggled” throughout PHP code G Criticism due to this (errors not detected at compile time) G Type is not explicitly set for variable by programmer G Type of variable is “juggled” throughout PHP code G Criticism due to this (errors not detected at compile time)

Types Eight different types: G Boolean G Integer G Float AKA Double G String G Array G Object G Resource G Null Eight different types: G Boolean G Integer G Float AKA Double G String G Array G Object G Resource G Null

Boolean G Trivial G Cast as (bool) or (boolean) G False is: G Integer - 0 G Float G String - Empty or “0” G NULL G Array - Size = 0 … among others G True is everything else G Trivial G Cast as (bool) or (boolean) G False is: G Integer - 0 G Float G String - Empty or “0” G NULL G Array - Size = 0 … among others G True is everything else

Integer G No unsigned integers in PHP G Include octal and hexadecimal numbers G Octal - 0[0-7]+ G Hex - 0[xX][0-9a-fA-F]+ G Overflow? Treats value as float G No division operator - yields float G Cast as (int) or (integer) G From float to integer - rounding towards zero G No unsigned integers in PHP G Include octal and hexadecimal numbers G Octal - 0[0-7]+ G Hex - 0[xX][0-9a-fA-F]+ G Overflow? Treats value as float G No division operator - yields float G Cast as (int) or (integer) G From float to integer - rounding towards zero

Float (Double) G Loss of precision when converted to internal binary G Ex: floor(( )*10) is 7, not 8 G Cast as (float), (double), or (real) G Loss of precision when converted to internal binary G Ex: floor(( )*10) is 7, not 8 G Cast as (float), (double), or (real)

String G No bound to size of strings G Single quotes G Escape ‘ or \ characters G Double quotes G More escaped characters (\n, \t, \\, etc) G No bound to size of strings G Single quotes G Escape ‘ or \ characters G Double quotes G More escaped characters (\n, \t, \\, etc)

Array G (key, value) pairs G Key may be an integer index, like Java arrays G print_r($arr); //Prints out array G (key, value) pairs G Key may be an integer index, like Java arrays G print_r($arr); //Prints out array

Object G Use “new” to create new instance G Cast as (object) - new instance of built-in class stdClass G “scalar” member contains value G Use “new” to create new instance G Cast as (object) - new instance of built-in class stdClass G “scalar” member contains value

Resource  “ A resource is a special variable, holding a reference to an external resource. ” Taken from the PHP Documentation G i.e. Connectors to DBs (mySQL, MSSQL, etc)  “ A resource is a special variable, holding a reference to an external resource. ” Taken from the PHP Documentation G i.e. Connectors to DBs (mySQL, MSSQL, etc)

Variables G Start with $, followed by underscore or letter, and then followed by (number | letter | underscore)* G Dynamic Scoping G Variable variables G Hold variable name as string G Start with $, followed by underscore or letter, and then followed by (number | letter | underscore)* G Dynamic Scoping G Variable variables G Hold variable name as string

Operators G Same as other PL’s G ===, !== G echo `shell command` G. (Yeah, that’s it) G Arrays G +, and equality across key/value pairs G Instanceof (Looks familiar?) G Same as other PL’s G ===, !== G echo `shell command` G. (Yeah, that’s it) G Arrays G +, and equality across key/value pairs G Instanceof (Looks familiar?)

Functions G Again, similar to what we already know G C++-style G i.e. function foo($myVal = 44){/*BODY*/} G return arrays to list G Store function name in variable G Again, similar to what we already know G C++-style G i.e. function foo($myVal = 44){/*BODY*/} G return arrays to list G Store function name in variable

Objects G Nothing new G parent - used in inheritance, refers to base class G PHP 5 is more extensive G Nothing new G parent - used in inheritance, refers to base class G PHP 5 is more extensive

References G Wikipedia - PHP G G PHP Manual G p p G Wikipedia - PHP G G PHP Manual G p p