PHP-language Variables, assingment and arithmetic operations Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and.

Slides:



Advertisements
Similar presentations
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Advertisements

Types and Arithmetic Operators
PHP-language, files Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Aalborg Media Lab 21-Jun-15 Software Design Lecture 2 “ Data and Expressions”
1 Key Concepts:  Data types in C.  What is a variable?  Variable Declaration  Variable Initialization  Printf()  Scanf()  Working with numbers in.
1 Introduction to Computers and Programming Class 3 Introduction to C Professor Avi Rosenfeld.
C PROGRAMMING LECTURE 17 th August IIT Kanpur C Course, Programming club, Fall by Deepak Majeti M-Tech CSE
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.
Development of Web Applications - Introduction Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information.
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)PHP Recap.
JavaScript – Part II Data Types and Operations George Mason University June 3, 2010.
Arrays in C++ Numeric Character. Structured Data Type A structured data type is a type that stores a collection of individual components with one variable.
1 CSE1301 Computer Programming Lecture 5: Components of a C Program (Part 1) Linda M c Iver.
Lecture-2 Operators and Conditionals. Variables(again???) Type: Representation of “bits” in memory Variables: Name for a memory object. Starts with letters,
Teppo Räisänen School of Business and Information Management Oulu University of Applied Sciences.
Arithmetic Operations. Review function statement input/output comment #include data type variable identifier constant declaration.
CSC 107 – Programming For Science. Announcements  Memorization is not important, but…  … you will all still be responsible for information  Instead.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
First steps Jordi Cortadella Department of Computer Science.
PHP-language, conditional statements Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management.
PHP Teppo Räisänen LIIKE/OAMK PHP PHP is a programming language for making dynamic and interactive Web pages.
1/28: Inputs, Variable Types, etc. Addition.java in depth Variable types & data types Input from user: how to get it Arithmetic operators.
Primitive Variables.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CSC 1051 – Algorithms and Data Structures I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Data Tonga Institute of Higher Education. Variables Programs need to remember values.  Example: A program that keeps track of sales needs to remember.
1 More data types Character and String –Non-numeric variables –Examples: char orange; String something; –orange and something are variable names –Note.
Creating PHP Pages Chapter 6 PHP Variables, Constants and Operators.
Programming Paradigms By Tyler Smith. Event Driven Event driven paradigm means that the program executes code in reaction to events. The limitation of.
PHP-language, sessions Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management
Variables Hold information that may be manipulated, used to manipulate other information or remembered for later use A storage location in memory (RAM)
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.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
Variables and Strings. Variables  When we are writing programs, we will frequently have to remember a value for later use  We will want to give this.
Python Programming Lecture II. Data Data is the raw material that programs manipulate. Data comes in different flavours. The basic ones are called “primitive.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 2 September 3, 2009.
ITM © Port, KazmanVariables - 1 ITM 352 Data types, Variables Class #4.
Primitive Data Types int is a primitive data type A primitive data type is one that stores only a single piece of data. TypeStorageDescription int 4 bytes+ve.
Arithmetic Operations (L05) * Arithmetic Operations * Variables * Declaration Statement * Software Development Procedure Problem Solving Using C Dr. Ming.
PHP-language, loops Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management
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:
NOTE: C programs consist of functions one of which must be main. C programs consist of functions one of which must be main. Every C program begins executing.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Chapter Four Common facilities of procedural languages.
Introduction to Python Lesson 2a Print and Types.
What will each of the following lines print? System.out.println("number" ); number645 System.out.println("number" + (6 + 4)+ 5); number105 System.out.println(6.
PHP using MySQL Database for Web Development (part II)
Lecture2.
Lecture 4: Expressions and Variables
Visual Basic Variables
Introduction to PHP Part 1
Design & Technology Grade 7 Python
Multiple variables can be created in one declaration
Variables, Expressions, and IO
Introduction to C++ October 2, 2017.
PHP-language Variables, assingment and arithmetic operations
Building Java Programs Chapter 2
Variables & Data Types Java.
CS150 Introduction to Computer Science 1
Reference semantics, variables and names
INC 161 , CPE 100 Computer Programming
Lecture 4: Expressions and Variables
Text Copyright (c) 2017 by Dr. E. Horvath
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Presentation transcript:

PHP-language Variables, assingment and arithmetic operations Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management

Variables Data prosessed by (web) application is stored into variables PHP-application is executed on web server -> variables are in the memory of the web server When you declare a variable, you don’t give datatype (but still variables do have datatype) -> PHP is so called loosely-typed programming language Basic datatypes: boolean, integer, floating point number and string

Declaring variables Variable declaring starts with $-character You invent the name for the variable Good practise is to give initial value Example: $age=0; $firstname=””; $isTrue=false;

Assignment (= operator) Assingment is used to store data into variable – User input – Result of an clause Examples. $age=24; $name=$_POST[”firstname”]; $total=$number1 + $number2; $fullname=$firstname. $surname;

Arithmetic operations +addition - subtraction / division * multiplication % remainder

Printing information with PHP echo, print ja printfprintf

Reading values from HTML-form using HTTP-post method