PHP Variables.  Variables are "containers" for storing information. How to Declare PHP Variables  In PHP, a variable starts with the $ sign, followed.

Slides:



Advertisements
Similar presentations
Using GET data within a IF Statement. If ($GETCom === ‘home’) { echo ’They Match’; } $GETCom = $_GET[‘com’]; If the data stored in the variable ($GETCom)
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
1 C++ Syntax and Semantics The Development Process.
Objective: Dealing with data in C++ Agenda: Notes Essay Help.
Chapter 2 Review Questions
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Input & Output: Console
Nael Alian Introduction to PHP
Section 2 Variables National 4/5 Scratch Course. What you should know after this lesson What a variable is Where variables are stored How to get data.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
PHP - Introduction Week 5 Dr. Ken Cosh Introducing PHP 1.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Web Programming Language Week 5 Dr. Ken Cosh Introducing PHP 1.
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.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
C++ Basics #7 Basic Input and Output. In this video Standard output (cout) Standard input (cin) stringstream.
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.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
Week 4 PHP H ypertext P reprocessor Reference : Official Site :
Variables in Java x = 3;. What is a variable?  A variable is a placeholder in memory used by programmers to store information for a certain amount of.
PHP. PHP User Defined Functions Besides the built-in PHP functions, we can create our own functions. A function is a block of statements that can be used.
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.
Variables and Assignment CSIS 1595: Fundamentals of Programming and Problem Solving 1.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Creating PHP Pages Chapter 6 PHP Variables, Constants and Operators.
Variables and Constants Objectives F To understand Identifiers, Variables, and Constants.
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.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
 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.
Session 2: PHP Language Basics iNET Academy Open Source Web Development.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
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 Algorithmic Processes CMPSC 201C Fall 2000.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
A Sample Program #include using namespace std; int main(void) { cout
1 C Syntax and Semantics Dr. Sherif Mohamed Tawfik Lecture Two.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
 The real power of PHP comes from its functions; it has more than 1000 built-in functions.  PHP User Defined Functions  Besides the built-in PHP functions,
JavaScript Variables. Definition A variable is a "container" for information you want to store. A variable's value can change during the script.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
PHP using MySQL Database for Web Development (part II)
Session 2 Basics of PHP.
A variable is a name for a value stored in memory.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Input and Output Upsorn Praphamontripong CS 1110
PHP 5 Syntax.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Variables, Expressions, and IO
Computer Science 3 Hobart College
Web Programming– UFCFB Lecture 19-20
PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume) Rules for PHP variables: A variable.
PHP Introduction.
Unit-1 Introduction to Java
PHP.
Tutorial 6 PHP & MySQL Li Xu
Tutorial 10: Programming with javascript
Understanding Variables
Variables and Constants
Presentation transcript:

PHP Variables

 Variables are "containers" for storing information. How to Declare PHP Variables  In PHP, a variable starts with the $ sign, followed by the name of the variable:  Examples : $txt = "Hello world!"; $x = 5; $y = 10.5;

 A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume.  A variable starts with the $ sign, followed by the name of the variable  A variable name must start with a letter or the underscore character

 A variable name cannot start with a number  A variable name can only contain alpha- numeric characters and underscores (A-z, 0- 9, and _ )  Variable names are case-sensitive ($age and $AGE are two different variables)  Note : Remember that PHP variable names are case-sensitive!

 The PHP echo statement is often used to output data to the screen.  The following example will show how to output text and a variable:

 Output will be I love Pakistan! Another example for variable addition: Code :

 PHP automatically converts the variable to the correct data type, depending on its value.  In other languages such as C, C++, and Java, the programmer must declare the name and type of the variable before using it.