PHP Arūnas Liuiza. PHP 101 What is PHP? Widely popular dynamic interpreted opensource programming language, aimed for web development Syntax is simmilar.

Slides:



Advertisements
Similar presentations
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.
Advertisements

IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
Website Development Introducing PHP The PHP scripting language Syntax derives from C, Java and Perl Open Source Links to MySql database.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
Server side basics.
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.
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 ’ Open-source, server-side scripting language Used to generate dynamic web-pages PHP scripts reside between reserved PHP.
PHP H ypertext P re-processor. Unit 6 - PHP - Hello World! - Data types - Control structures - Operators.
INTERNET APPLICATION DEVELOPMENT For More visit:
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Nael Alian Introduction to PHP
Week 9 PHP Cookies and Session Introduction to JavaScript.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
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.
PHP Logic. Review: Variables Variables: a symbol or name that stands for a value – Data types ( Similar to C++ or Java): Int, Float, Boolean, String,
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
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.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
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.
PHP - 1h. How it works Client requests document Server loads document in memory Server processes document with relevant module (PHP) Server sends XHTML.
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.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
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.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Creating PHP Pages Chapter 6 PHP Variables, Constants and Operators.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.
Chapter 3 Introduction to PHP. Incorporating PHP Within HTML By default, PHP documents end with the extension.php files ending with.htm or.html to also.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
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.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
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 Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
PHP using MySQL Database for Web Development (part II)
Chapter 6 JavaScript: Introduction to Scripting
CHAPTER 5 SERVER SIDE SCRIPTING
Operators Operators are symbols such as + (addition), - (subtraction), and * (multiplication). Operators do something with values. $foo = 25; $foo – 15;
Introduction to PHP Part 1
Web Technologies PHP 5 Basic Language.
PHP (PHP: Hypertext Preprocessor)
Web Programming– UFCFB Lecture 19-20
PHP Introduction.
Java Programming: From Problem Analysis to Program Design, 4e
Chapter 19 JavaScript.
JavaScript an introduction.
Introduction to C++ Programming
PHP.
COM-152: Computer Programming Types, Variables, Operators Part 1 of 2
PHP an introduction.
23 PHP.
Presentation transcript:

PHP Arūnas Liuiza

PHP 101

What is PHP? Widely popular dynamic interpreted opensource programming language, aimed for web development Syntax is simmilar to C, Perl, Java PHP code snippets can be inserted to a HTML document

PHP Syntax

Inserting to HTML Long tags... Short tags ir Not recommended due to compatability reasons

Output Main function to output data: echo echo “Hello”; echo 12345;

Į TERPIMAS Į HTML. P AVYZDYS

Instruction separation Semicolon (;) is used to separate instructions from one another

Comments PHP has three types of comments Single line (till the end of line or ?>) : // comment # comment Multi-line /* comment carries to another line and another… */

Variables Symbolic name, that can have a value assigned to it Starts with dollar ($) sign $first First symbol has to be a letter or an underscore (_) $start $_with_underscore Can also contain numbers $p123_44dlsdm_ $_1234ps Variable names are Case Sensitive $Pirmas != $pirmas $DuKartai != $dukartai

Variables. Examples $foo = 15; echo ‘foo is ‘.$foo; $foo = “Peter”; echo ‘foo is ‘.$foo; $foo = “Peter”; $foo = “John”; echo ‘foo is ‘.$foo; foo is 15 foo is Peter foo is John CodeResult

Main PHP data types Boolean Logical true/false Integer 1, 2, 3, 4… Float , String ‘Text’ Array Object Resource NULL No value

B OOLEAN Logical true or false value $a = true; $a = FaLsE; Possible FALSE values: FALSE ‘’ ir ‘0’ Empty array Object without members NULL Anything else - TRUE

Type casting PHP does not require strict definition of variable data type – type is converted according to context

Operators PHP operators are divided to: Arithmetical Value assigning Comparison Logical

Arithmetical + Sum$a = Subtract$a = 4 – 2 * Multiply$a = 2 * 2 / Divide$a = 4 / 2 % Division module$a = 5 % 2 (=1) ++ Add 1++$a -- Subtract 1--$a. Connect two strings $a = “raga”. “nosis”

Value assigning = $x = $y += $x += $y$x = $x + $y -= $x -= $y$x = $x - $y *= $x *= $y$x = $x * $y /= $x /= $y$x = $x / $y.= $x.= $y$x = $x. $y %= $x %= $y$x = $x % $y

Comparison == Equal5==8 false != Not equal5!=8 true <> Not equal5<>8 true > More5>8 false < Less5<8 true >= More or equal5>=8 false <= Less or equal5<=5 true

Logical && AND || OR ! NOT

Exercise

Task no 1 1. Multiply N by 3 2. Add 15 to the result 3. Find module of division by 4 of the result 4. Add 2 to the result 5. Raise the result to the second power (Res 2 ) 6. Subtract 1.5 from the result 7. Divide result by 3 Write a program that executes the operations one by one, outputing the result after each operation