CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.

Slides:



Advertisements
Similar presentations
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
Advertisements

PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Php. What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on.
PHPPHP What is PHP? Hypertext Pre-processor (PHPs) is a server- side scripting language In early versions, PHP stand for Personal Home Page. server-side.
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).
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
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.
PHP / MySQL. What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed.
Mandakini Ayushi Infotech Mandakini Kumari 22 nd July PHP Basic.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Nael Alian Introduction to PHP
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
2440: 211 Interactive Web Programming Expressions & Operators.
Variables, Operators and Data Types. By Shyam Gurram.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Basics and uses of php Prepared By
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
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. 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.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
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.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
PHP Introduction PHP is a server-side scripting language.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
Session 2: PHP Language Basics iNET Academy Open Source Web Development.
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.
PHP-Basic By- Tanvi Raval. Pre-requisites Before you continue you should have a basic understanding of the following: 1. HTML 2. JavaScript.
PHP Overview. What is PHP Widely available scripting language Free Alternative to Microsoft’s ASP Runs on the Web Server; not in the browser Example:
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
CGS 3066: Web Programming and Design Spring 2016 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.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
1 Server Side scripting PHP. 2 What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are.
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)
CGS 3066: Web Programming and Design Spring 2017
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CHAPTER 5 SERVER SIDE SCRIPTING
Introduction to Web programming
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
PHP Rasmus Lerdorf.
PHP Introduction.
PHP.
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
PHP an introduction.
23 PHP.
Algoritma & Pemrograman 1
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Web Application Development Using PHP
Contact PSK Technologies Pvt. Ltd IT Company Address - Plot No-780, Near Durga Temple, Katol Road Chaoni, Nagpur-13.
Presentation transcript:

CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1

Content PHP 5 Introduction PHP 5 Syntax PHP 5 Variables PHP 5 echo and print Statements PHP 5 Data Types PHP 5 Strings PHP 5 Constants PHP 5 Operators 2

PHP 5 Introduction PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP. 3 What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use

PHP 5 Introduction (cont.) What is a PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have extension ".php" 4

PHP 5 Introduction (cont.) What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database PHP can be used to control user-access PHP can encrypt data 5 Why PHP? PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP supports a wide range of databases PHP is free. Download it from the official PHP resource: PHP is easy to learn and runs efficiently on the server side

PHP 5 Syntax Basic PHP Syntax A PHP script can be placed anywhere in the document. A PHP script starts with : My first PHP page Note: PHP statements end with a semicolon (;). 6

PHP 5 Syntax (cont.) Comments in PHP 7

PHP 5 Syntax (cont.) PHP Case Sensitivity "; echo "Hello World! "; EcHo "Hello World! "; ?> 8 "; echo "My house is ". $COLOR. " "; echo "My boat is ". $coLOR. " "; ?> ?

PHP 5 Variables Creating (Declaring) PHP Variables 9 PHP Variables Rules for PHP variables: A variable starts with the $ sign, followed by the name of the variable A variable name must start with a letter or the underscore character A variable name cannot start with a number A variable name can only contain alpha-numeric characters and underscores (A- z, 0-9, and _ ) Variable names are case-sensitive ($age and $AGE are two different variables) Remember that PHP variable names are case-sensitive!

PHP 5 Variables (cont.) Output Variables 10 PHP Variables Scope PHP has three different variable scopes: local global static

PHP 5 Variables (cont.) Global and Local Scope Variable x inside function is: $x "; } myTest(); echo " Variable x outside function is: $x "; ?> 11

PHP 5 Variables (cont.) PHP The global Keyword 12 PHP The static Keyword

PHP 5 echo and print Statements PHP echo and print Statements PHP is Fun! "; print "Hello world! "; ?> 13

PHP 5 Data Types PHP Data Types PHP supports the following data types: String Integer Float (floating point numbers - also called double) Boolean Array Object NULL Resource 14

PHP 5 Data Types (cont.) PHP String 15 PHP Integer PHP Float PHP Boolean $x = true; $y = false;

PHP 5 Data Types (cont.) PHP Array 16 PHP Object model = "VW"; } } // create an object $herbie = new Car(); // show object properties echo $herbie->model; ?>

PHP 5 Data Types (cont.) PHP NULL Value 17

PHP 5 Strings Get The Length of a String 18 Count The Number of Words in a String Reverse a String Search For a Specific Text Within a String Replace Text Within a String

PHP 5 Constants Create a PHP Constant Syntax define(name, value, case-insensitive) Example 19

PHP 5 Operators PHP Operators Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators Assignment operators Comparison operators Increment/Decrement operators Logical operators String operators Array operators 20

PHP 5 Operators (cont.) PHP Arithmetic Operators 21 OperatorNameExampleResult + Addition$x + $ySum of $x and $y - Subtraction$x - $yDifference of $x and $y * Multiplication$x * $yProduct of $x and $y / Division$x / $yQuotient of $x and $y % Modulus$x % $yRemainder of $x divided by $y ** Exponentiation$x ** $yResult of raising $x to the $y'th power (Introduced in PHP 5.6)

PHP 5 Operators (cont.) PHP Assignment Operators 22 AssignmentSame as...Description x = y The left operand gets set to the value of the expression on the right x += y x = x + yAddition x -= y x = x - ySubtraction x *= y x = x * yMultiplication x /= y x = x / yDivision x %= y x = x % yModulus

PHP 5 Operators (cont.) PHP Comparison Operators 23 OperatorNameExampleResult == Equal$x == $yReturns true if $x is equal to $y === Identical$x === $yReturns true if $x is equal to $y, and they are of the same type != Not equal$x != $yReturns true if $x is not equal to $y <> Not equal$x <> $yReturns true if $x is not equal to $y !== Not identical$x !== $yReturns true if $x is not equal to $y, or they are not of the same type > Greater than$x > $yReturns true if $x is greater than $y < Less than$x < $yReturns true if $x is less than $y >= Greater than or equal to $x >= $yReturns true if $x is greater than or equal to $y <= Less than or equal to $x <= $yReturns true if $x is less than or equal to $y

PHP 5 Operators (cont.) PHP Increment / Decrement Operators 24 OperatorNameDescription ++$xPre-incrementIncrements $x by one, then returns $x $x++Post-incrementReturns $x, then increments $x by one --$xPre-decrementDecrements $x by one, then returns $x $x--Post-decrementReturns $x, then decrements $x by one

PHP 5 Operators (cont.) PHP Logical Operators 25 OperatorNameExampleResult andAnd$x and $yTrue if both $x and $y are true orOr$x or $yTrue if either $x or $y is true xorXor$x xor $yTrue if either $x or $y is true, but not both &&And$x && $yTrue if both $x and $y are true ||Or$x || $yTrue if either $x or $y is true !Not!$xTrue if $x is not true PHP String Operators OperatorNameExampleResult. Concatenation$txt1. $txt2Concatenation of $txt1 and $txt2.= Concatenation assignment $txt1.= $txt2Appends $txt2 to $txt1

PHP 5 Operators (cont.) PHP Array Operators 26 OperatorNameExampleResult + Union$x + $yUnion of $x and $y == Equality$x == $yReturns true if $x and $y have the same key/value pairs === Identity$x === $yReturns true if $x and $y have the same key/value pairs in the same order and of the same types != Inequality$x != $yReturns true if $x is not equal to $y <> Inequality$x <> $yReturns true if $x is not equal to $y !== Non-identity$x !== $yReturns true if $x is not identical to $y

27 THE END