Hello world <?php print "hello world"; ?>. Variables A variable consists of a name that you can choose, preceded by a dollar ($) sign. Some legal variables.

Slides:



Advertisements
Similar presentations
Creating PHP Pages Chapter 7 PHP Decisions Making.
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.
PHP Functions and Control Structures. 2 Defining Functions Functions are groups of statements that you can execute as a single unit Function definitions.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
ITC 240: Web Application Programming
Basic Elements of Programming A VB program is built from statements, statements from expressions, expressions from operators and operands, and operands.
Selection Statements choice of one among several blocks of code Java supports 3 kinds of selection statements: if statement – selects one block or leaves.
Switch structure Switch structure selects one from several alternatives depending on the value of the controlling expression. The controlling expression.
Chapter 4 Functions and Control Structures PHP Programming with MySQL.
Loops – While, Do, For Repetition Statements Introduction to Arrays
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Control Structure.
CS 117 Spring 2002 Review for Exam 2 March 6, 2002 open book, 1 page of notes.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
Quiz 1 Exam 1 Next Week. Nested if Statements if (myGrade >= 80) if (myGrade >= 90) cout
CONTROL STATEMENTS Lakhbir Singh(Lect.IT) S.R.S.G.P.C.G. Ludhiana.
 Decision making statements Decision making statements if statement if...else statement Nested if...else statement (if...elseif....else Statement) 
CIS3931 – Intro to JAVA Lecture Note Set 3 19-May-05.
Chapter 5: Control Structures II (Repetition)
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
Lecture 10: Reviews. Control Structures All C programs written in term of 3 control structures Sequence structures Programs executed sequentially by default.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Lecture 8: Choosing the Correct Loop. do … while Repetition Statement Similar to the while statement Condition for repetition only tested after the body.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
PHP Conditional Statements Conditional statements in PHP are used to perform different actions based on different conditions. Conditional Statements Very.
PHP Programming with MySQL Slide 4-1 CHAPTER 4 Functions and Control Structures.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
Chapter 4 Loops Write code that prints out the numbers Very often, we want to repeat a (group of) statement(s). In C++, we have 3 major ways of.
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
ㅎㅎ logical operator if if else switch while do while for Third step for Learning C++ Programming Repetition Control Structures.
Chapter 3. Outline Relational Operators Loops Decisions Logical Operators Precedence Summary.
PHP Constructs Advance Database Management Systems Lab no.3.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 ‏ Control Structures.
Lecture 2 Control Structure. Relational Operators -- From the previous lecture Relational Operator Meaning == is equal to < is less than > is greater.
CHAPTER 3 CONTROL STRUCTURES ( REPETITION ) I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
1 PHP Introduction Chapter 1. Syntax and language constructs.
JavaScript, Fourth Edition
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Matlab Programming for Engineers
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
PHP Programming with MySQL Slide 3-1 CHAPTER 3 Working with Data Types and Operators.
Expressions and Control Flow. Expressions An expression is a combination of values, variables, operators, and functions that results in a value y = 3(abs(2x)
An Object-Oriented Approach to Programming Logic and Design Chapter 5 Making Decisions.
Program Structures Chapter 5. 5 Branching Allows different code to execute based on a conditional test. if, if-else, and switch statements.
Control structures in C by Dr P.Padmanabham Professor (CSE)&Director Bharat Institute of Engineering &Technology Hyderabad Mobile
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.
CC213 Programming Applications Week #2 2 Control Structures Control structures –control the flow of execution in a program or function. Three basic control.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 2: Control Structures (Selection & Repetition)
C Program Control September 15, OBJECTIVES The essentials of counter-controlled repetition. To use the for and do...while repetition statements.
 2006 Pearson Education, Inc. All rights reserved if…else Double-Selection Statement if – Performs action if condition true if…else – Performs.
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
UMBC CMSC 104 – Section 01, Fall 2016
REPETITION CONTROL STRUCTURE
JavaScript: Control Statements I
Expressions and Control Flow in JavaScript
JavaScript: Control Statements I
String Conversion and Type Juggling
Chapter 5 Repetition.
M275 – Web Development Using PHP and MySQL
Program Flow.
Chap 7. Advanced Control Statements in Java
Controlling Program Flow
Presentation transcript:

Hello world <?php print "hello world"; ?>

Variables A variable consists of a name that you can choose, preceded by a dollar ($) sign. Some legal variables $a; $a_longish_variable_name; $_2453; $sleepyZZZZ;

Data Types PHP is loosely typed, which means it calculates data types as data is assigned to each variable You can use PHP's built-in function gettype () to acquire the type of any variable

An operator is a symbol or series of symbols that, when used with values, performs an action and usually produces a new value. An operand is a value used in conjunction with an operator. There are usually two operands to one operator.

The Assignment Operator $name = "matt"; Arithmetic Operators + - * / %

The Concatenation Operator "hello"." world" is equivalent to "hello world" $centimeters = 212; print "the width is ".($centimeters/100)." meters";

Logical Operators true || false returns true. true && false returns false.

CONSTANT define ("CONSTANT_NAME", 42); <?php define ("USER", "Gerald"); print "Welcome".USER; ?>

The if Statement if (expression) { // code to execute if the expression evaluates to true } Using the else Clause with the if Statement if (expression) { // code to execute if the expression evaluates to true } else { // code to execute in all other cases }

Using the else if Clause with the if Statement if ( expression ) { // code to execute if the expression evaluates to true } else if ( another expression ) { // code to execute if the previous expression failed // and this one evaluates to true } else { // code to execute in all other cases }

The switch Statement switch (expression) { case result1: // execute this if expression results in result1 break; case result2: // execute this if expression results in result2 break; default: // execute this if no break statement // has been encountered hitherto }

Loops while ( expression ) { // do something } <?php $counter = 1; while ( $counter <= 12 ) { print "$counter times 2 is ".($counter*2)." "; $counter++; } ?>

The do...while Statement do { // code to be executed } while (expression); <?php 11: $num = 1; 12: do { 13: print "Execution number: $num \n"; 14: $num++; 15: } while ( $num > 200 && $num < 400 ); 16: ?>

The for Statement for ( initialization expression; test expression; modification expression ) { // code to be executed } <?php 11: for ( $counter=1; $counter<=12; $counter++ ) { 12: print "$counter times 2 is".($counter*2)." "; 13: }

Nesting Two for Loops * ** *** **** ***** Triangle Downward triangle

Function 10: <?php 11: function bighello() { 12: print " HELLO! "; 13: } 14: bighello(); 15: ?>

Function That Returns a Value 10: <?php 11: function addNums( $firstnum, $secondnum ) { 12: $result = $firstnum + $secondnum; 13: return $result; 14: } 15: print addNums(3,5); 16: // will print "8" 17: ?>

Array $users = array ("Bert", "Sharon", "Betty", "Harry"); You can now access the third element in the $user array by using the index 2: print $users[2];

Assignment Update and delete Designing Studio 3d max Maya PhotoShop Corel Draw Gaming