UNIVERISTY OF SOMALIA College of Engineering and Computer Science Course code: N/A COURSE: WEB DEVELOPMENT WITH PHP

Slides:



Advertisements
Similar presentations
Introduction to PHP Dr. Charles Severance
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
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.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Java An introduction. Example 1 public class Example1 { public static void main (String [] args) { System.out.println (“This is the first example”); int.
Expressions and Control Flow in PHP Dr. Charles Severance
JavaScript, 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”
CSC 405: Web Application And Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming.
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)PHP Recap.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
Week 9 PHP Cookies and Session Introduction to JavaScript.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
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.
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. 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.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
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 Arūnas Liuiza. PHP 101 What is PHP? Widely popular dynamic interpreted opensource programming language, aimed for web development Syntax is simmilar.
Introducing JavaScript. Goals By the end of this lecture you should … Be able to describe the differences among object methods, object properties and.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
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.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Creating PHP Pages Chapter 6 PHP Variables, Constants and Operators.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
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.
CSC 405: Web Application Engineering II 2.1 Web Programming with PHP Introduction to Web programming Introduction to Web programming The programming language.
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.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Expressions and Control Flow in PHP. Expressions Expressions evaluate to a value. The value can be a string, number, boolean, etc... Expressions often.
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.
Session 2: PHP Language Basics iNET Academy Open Source Web Development.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
PHP using MySQL Database for Web Development (part II)
Expressions and Control Flow in PHP
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
Chapter 6 JavaScript: Introduction to Scripting
CHAPTER 5 SERVER SIDE SCRIPTING
JavaScript is a programming language designed for Web pages.
Introduction to Computer Science / Procedural – 67130
PHP (PHP: Hypertext Preprocessor)
Exploring JavaScript Ch 14
Introduction to Scripting
JavaScript Syntax and Semantics
ITM 352 Expressions, Precedence, Working with Strings Class #5
Web Programming– UFCFB Lecture 19-20
PHP Introduction.
Expressions and Control Flow in PHP
Java Programming: From Problem Analysis to Program Design, 4e
WEB PROGRAMMING JavaScript.
PHP.
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
PHP an introduction.
Web Programming and Design
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

UNIVERISTY OF SOMALIA College of Engineering and Computer Science Course code: N/A COURSE: WEB DEVELOPMENT WITH PHP THE KEY TO THE PHP Class: CS12F THIRD week Lecturer: Mohamed-Nur Hussein Abdullahi Hame (M.Sc in CSE) :30 -12: 30 Course time

SYNTAX, VARIABLES, COMMENTS, OPERATORS AND CONTROL STRUCTURES PROGRAMMING WITH PHP

OPENING AND CLOSING PHP (This is the most used to open and close PHP) or (ASP style, considered as bad form) or (ASP style, very bad form)

PHP’s Syntax Is C-Like If you know how to program with C language, it’s helpful PHP is whitespace insensitive. PHP is not a case sensitive language but sometimes PHP 0is case sensitive. Statements are expressions terminated by semicolons. A statement in PHP is any expression that is followed by a semicolon (;) Expressions are combinations of tokens.

Comments C-style multiline comments /* This is a comment in PHP */ Single-line comments: # and // # This is a comment, and # this is the second line of the comment // This is a comment too

PHP VARIABLES

PHP variables are Perl-like All variables in PHP are denoted with a leading dollar sign ($). The value of a variable is the value of its most recent assignment. Variables are assigned with the = operator. Variables can, but do not need, to be declared before assignment. Variables have no basic type other than the type of their current value. No variable type declaration, php converts data types automatically Variables used before they are assigned have default values No spaces in the variables, and they are case sensitive.

ASSIGNING, REASSIGNING VARIABLES $JusNumber = ; REASSIGNING: $Var = “This is just a text”; $Var = 55; If the second statement immediately follows the first one, the first statement has essentially no effect.

PHP OPERATORS Arithmetic operators: + - * / % Logical operators: and, or, !, &&, || Comparison operators: ==, !=,, = Identity operator (===): True if its arguments are equal to each other and of the same type, but false otherwise.

Operators of Note Increment / Decrement ( ) String concatenation (. ) Equality ( == != ) Identity ( === !== ) Ternary ( ? : ) Side-effect Assignment ( += -=.= etc.)

Increment / Decrement These operators allow you to both retrieve and increment / decrement a variable. $x = 12; $y = 15 + $x++; echo "x is $x and y is $y \n";

String Concatenation PHP uses the period character for concatenation because the plus character would instructor PHP to to the best it could do to add the two things together, converting if necessary. $a = 'Hello '. 'World!'; echo $a. "\n";

Ternary operator The ternary operator comes from C. It allows conditional expressions. It is like a one-line if-then-else. $www = 123; $msg = $www > 100 ? "Large" : "Small" ; echo "First: $msg \n"; $msg = ( $www % 2 == 0 ) ? "Even" : "Odd"; echo "Second: $msg \n"; $msg = ( $www % 2 ) ? "Odd" : "Even"; echo "Third: $msg \n";

EXAMPLES

EXAMPLE 1 – Assigning by reference OUTPUT: Let me tell you that I love Hiiraan

EXAMPLE 2 – Assign by value OUTPUT: Hiiraan

EXAMPLE 3 – Using print instead of echo <?php $many = 5; $many_2 = 7; $few = $many + $many_2; print("$many + $many_2 = $few "); ?> OUTPUT: = 12

EXAMPLE 4 – Using single and double quotations <?php $variable = "name"; $literally = 'My $variable will not print!'; print($literally); print " "; $literally = "My $variable will print!"; print($literally); ?> OUTPUT: My $variable will not print! My name will print

EXAMPLE 5 – Displaying HTML code <?php // Displaying HTML code echo " This is a simple heading. "; echo " This is heading with style. " ?> OUTPUT: This is a simple heading. This is heading with style.

THANK YOU!

ANY QUESTIONS?

ABOUT THE LECTURER Mohamed-Nur Hussein Master of science in Computer Science & Daffodil International FEEL FREE TO CONTACT ME: Recommendation: The following fonts are required for better presentation resolution: (Aachen BT, Franklin Gothic Demi Cond, Rockwell, Calibri, Calibri Light (Headings), Arial) (Dhaka – Bangladesh) Freelancer and website designer Part-time lecturer at: University of Somalia (UNISO) ANY FEEDBACK OR SUGESSIONS?  PLEASE LET ME KNOW IF YOU HAVE ANY FEEDBACK REGARDING THE COURSE. THANKS!