PHP - 1h. How it works Client requests document Server loads document in memory Server processes document with relevant module (PHP) Server sends XHTML.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
IST 221 Internet Concepts and Applications Introduction to PHP.
PHP Intro/Overview Squirrel Book pages Server-side Scripting Everything you need to know in one slide 1.Web server (with PHP “plug-in”) gets a.
Copyright 2009 Justin C. Klein Keane PHP Code Auditing Session 1 – PHP Foundations Justin C. Klein Keane
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Control Structures, Operators, and Functions.
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.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
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.
1 Introduction to PHP. 2 What is this “PHP” thing? Official description: “PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source.
PHP : Hypertext Preprocessor
CSC 405: Web Application And Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming.
PHP H ypertext P re-processor. Unit 6 - PHP - Hello World! - Data types - Control structures - Operators.
University of Sunderland Lecture 1 Internet Software Architectures Lecture 1: Introduction.
INTERNET APPLICATION DEVELOPMENT For More visit:
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
School of Computing and Information Systems CS 371 Web Application Programming PHP - Basics Serving up web pages.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
Intro to PHP – Page 1 of 43CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: Intro to PHP Reading: Chapters 1.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
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 - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
Overview: 1. Discussion of the basic architecture of a web application. 2. Discussion of the relevance of using MySQL and PHP in a web application.
1 CS428 Web Engineering Lecture 20 Control Structures, Loops and Pointers File Uploading Function (PHP - III)
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.
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.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
PHP Arūnas Liuiza. PHP 101 What is PHP? Widely popular dynamic interpreted opensource programming language, aimed for web development Syntax is simmilar.
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.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
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.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
 A PHP script can be placed anywhere in the document.  A PHP script starts with  The default file extension for PHP files is ".php".  A PHP file normally.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
CSC 405: Web Application Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming language.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
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.
Introduction to PHP 1.What is PHP? What Is PHP?  php: hypertext preprocessor  Server-side scripting language—like ASP—scripts are executed on server.
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,
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Unit – 3 Control structures. Condition Statements 1.If.…..else :- Has someone ever told you, "if you work hard, then you will succeed"? And what happens.
11 – Introduction to PHP(1) Informatics Department Parahyangan Catholic University.
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.
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.
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
PHP An introduction. September 2012Web Programming2 On the web ● ● “PHP is a widely-used general-purpose scripting.
A pache M ySQL P hp Robert Mudge Reference:
1 1 إعداد : عبدالرحمن محجوب حمد م 2017 تقنيات الانترنت 2 mtc.edu.sd.
PHP using MySQL Database for Web Development (part II)
Session 2 Basics of PHP.
Tutorial 10 Programming with JavaScript
Arrays An array in PHP is an ordered map
PHP (PHP: Hypertext Preprocessor)
محاضرة 1: مقدمة للمسـاق و مراجعـة للأساسيـات
PHP Intro/Overview Bird Book pages 1-11,
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
C# Revision Cards Data types
PHP an introduction.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

PHP - 1h

How it works Client requests document Server loads document in memory Server processes document with relevant module (PHP) Server sends XHTML document to client Client displays document

Hello World!

Output 1 Hello World

Output 2 Hello World

PHP Syntax basics PHP code embedded in Files containing PHP code must have a.php extension (or php3, etc) Syntax very similar to C and Java –Comments as in C/Java: /* comment */ // comment –But also: # comment

PHP Syntax basics Syntax very similar to C and Java –Statements delimited by ; Variables preceded by $, for example: –$x = 2; –$first_name = joe;

Data types Integer – for whole numbers Float – for real numbers String – for strings of characters Boolean – for true or false values Array – For collections of data Object – For OO programming

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo $first_name; ?> Output: John

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo ‘$first_name’; ?> Output: $first_name

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo “$first_name”; ?> Output: John

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo "You said: \"my name is $first_name $last_name\"";?> Output: You said: “my name is John Doe”

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo $first_name{0}; ?> Output: J

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo substr('abcdef', 1, 4); ?> Output: bcde

Strings <?php $first_name = ‘John’; $last_name = ‘Doe’; echo substr($first_name, 0, 6); ?> Output: ??? you tell me!!

Integers and Floats <?php $a = 1234; $b = 12.02; ?> Integer type: Float type:

Boolean Logical operators: –And: && –Or: ¦¦ –Not: ! Boolean type:

Array idFirst NameLast NameJob 1JoeSmithSurgeon 2JohnJohnsonNurse 3JackJacksonConsultant 4JimJonesIT

Numerically indexed array <?php $names = array(‘Joe’, ‘John’, ‘Jack’, ‘Jim’ ); echo $names[1]; ?> Output: John

if, else, elseif <?php $value = 24; if ($value < 20) echo “not enough!”; elseif ($value < 30) echo “reasonable.”; elseif ($value < 40) echo “ok!”; else echo “Too much!”; ?>

switch <?php switch ($value){ case 24: echo "Correct!"; break; case 25: echo "Almost correct!"; break; default: echo "Too much!"; }?>

for <?php for ( ; ; ) { } ?> ($i = 1$i <= 10 $i++ echo $i; Output:

for <?php for ($i = 1; $i <= 10; $i++) { echo $i; } ?> Output:

foreach <?php $arr = array("one", "two", "three"); echo "Using a for loop: \n"; for ($i = 0; $i < sizeof($arr); $i++) { echo "Value: $arr[$i] \n"; } echo "Using a foreach loop: \n"; foreach ($arr as $value) { echo "Value: $value \n"; } ?>

while <?php $i = 1; while ($i <= 10) { echo $i i++; } Output: