23 PHP.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

1 PHP  Introduction to PHP  Basic Syntax of PHP Variables, Constant, Data Type, Type Casting  Getting Data From Client  PHP Database Manipulation.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
PHP Introduction.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic PHP.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(26) PHP (Personal Home Page)
ASP.NET Programming with C# and SQL Server First Edition
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Introduction to scripting
 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.
PHP: Introduction By Trevor Adams.
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”
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
Chapter 4: Basics of PHP 42. Topics Introduction Creating and Executing PHP Programs Variables Operators Constant Arrays String Processing and Regular.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
Chap 3: Web Programming (CCSB144) - PHP 42 Chapter 4 - PHP Outline Introduction PHP String Processing and Regular Expressions Viewing Client/Server Environment.
 2008 Pearson Education, Inc. All rights reserved PHP.
Jozef Goetz contribution, Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
INTERNET APPLICATION DEVELOPMENT For More visit:
COP 3813 Intro to Internet Computing Prof. Roy Levow PHP.
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.
JavaScript Syntax, how to use it in a HTML document
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
 2008 Pearson Education, Inc. All rights reserved PHP.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Chap 2 – Getting Started COMP YL Professor Mattos.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
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,
REEM ALMOTIRI Information Technology Department Majmaah University.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
Web Database Programming Using PHP
Module 1 Introduction to JavaScript
Chapter 19 PHP Part I Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
PHP for Server-Side Programming
CX Introduction to Web Programming
PHP: Introduction By Trevor Adams.
Chapter 6 JavaScript: Introduction to Scripting
Chapter 26 - PHP Outline 26.1 Introduction 26.2 PHP
Web Database Programming Using PHP
PHP (PHP: Hypertext Preprocessor)
23 PHP.
Introduction to Scripting
PHP Introduction.
Chapter 7 - JavaScript: Introduction to Scripting
Objectives Insert a script element Write JavaScript comments
JavaScript: Introduction to Scripting
WEB PROGRAMMING JavaScript.
PHP.
Web DB Programming: PHP
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
PHP an introduction.
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

23 PHP

23.1 Introduction 23.2   PHP Basics 23.3   String Processing and Regular Expressions 23.3.1  Comparing Strings 23.3.2  Regular Expressions 23.4   Form Processing and Business Logic 23.5   Connecting to a Database 23.6   Using Cookies 23.7   Dynamic Content 23.8   Operator Precedence Chart 23.9   Wrap-Up 23.10 Web Resources

23.1 Introduction PHP, or PHP: Hypertext Preprocessor, has become one of the most popular server-side scripting languages for creating dynamic web pages. PHP is open source and platform independent—implementations exist for all major UNIX, Linux, Mac and Windows operating systems. PHP also supports a large number of databases.

23.2 PHP Basics The power of the web resides not only in serving content to users, but also in responding to requests from users and generating web pages with dynamic content. PHP code is embedded directly into XHTML documents, though these script segments are interpreted by a server before being delivered to the client. PHP script file names end with .php. In PHP, code is inserted between the scripting delimiters <?php and ?>. PHP code can be placed anywhere in XHTML markup, as long as the code is enclosed in these delimiters.

23.2 PHP Basics (Cont.) Variables are preceded by a $ and are created the first time they are encountered. PHP statements terminate with a semicolon (;). Single-line comments which begin with two forward slashes (//) or a pound sign (#). Text to the right of the delimiter is ignored by the interpreter. Multiline comments begin with delimiter /* and end with delimiter */. When a variable is encountered inside a double-quoted ("") string, PHP interpolates the variable. In other words, PHP inserts the variable’s value where the variable name appears in the string. All operations requiring PHP interpolation execute on the server before the XHTML document is sent to the client.

Outline Delimiters enclosing PHP script first.php Declares and initializes a PHP variable Interpolates the variable so that its value will be output to the XHTML document

23.2 PHP Basics (Cont.) Type conversions can be performed using function settype. This function takes two arguments—a variable whose type is to be changed and the variable’s new type. Function gettype returns the current type of its argument. Calling function settype can result in loss of data. For example, doubles are truncated when they are converted to integers. When converting from a string to a number, PHP uses the value of the number that appears at the beginning of the string. If no number appears at the beginning, the string evaluates to 0. The concatenation operator (.) combines multiple strings.

Outline (1 of 3) Automatically declares a string data.php (1 of 3) Automatically declares a string Automatically declares a double Automatically declares an integer Outputs the type of $testString

Outline (2 of 3) Modifies $testString to be a double data.php (2 of 3) Modifies $testString to be a double Modifies $testString to be an integer Modifies $testString to be a string

Outline Temporarily casts $data as a double and an integer (3 of 3) data.php (3 of 3) Concatenation

23.2 PHP Basics (Cont.) Function define creates a named constant. It takes two arguments—the name and value of the constant. An optional third argument accepts a boolean value that specifies whether the constant is case insensitive—constants are case sensitive by default. Uninitialized variables have the value undef, which has different values, depending on its context. In a numeric context, it evaluates to 0. In a string context, it evaluates to an empty string ("").

Outline (1 of 3) Creates the named constant VALUE with a value of 5 operators.php (1 of 3) Creates the named constant VALUE with a value of 5 Equivalent to $a = $a * 2

Outline operators.php (2 of 3) Uses a comparison operator with a variable and an integer Uninitialized variable $num evaluates to 0

Outline $str is converted to an integer for this operation (3 of 3) operators.php (3 of 3)