eemployment-h100
ee_logo_90
Index of the Handbook Index of the Lesson First Page Previous Page Next Page Last Page Objectives of the Lesson Download Questions Bibliography of the Lesson Knowledge Consolidation Page Assistent
Movie Quizzes of the Lesson 50
14 / zyxxyz en-language

2.3.    Variables in PHP

 

All variables in PHP start with: $ (symbol). The $ symbol is followed by the name of the variable. The name must not start with a number. It must start only with lowercase or uppercase letter or underscore followed by any letters, numbers or underscores. The variable name is case-sensitive. For example, the following variables: $words, $Words, $_words, are different

 

You assign the name of the variable. A suggestive name is better to use for the variable. This will help in your work.

 

It is not necessary to initialize variables in PHP however it is a very good practice. Un-initialized variables have a default value of their type - FALSE, zero, empty string or an empty array.

 

Example 4:   (inside of echo statement you can use variables.)

 

<?php


Index of the Handbook Index of the Lesson First Page Previous Page Next Page Last Page Objectives of the Lesson Download Questions Bibliography of the Lesson Knowledge Consolidation Page Assistent Movie Quizzes of the Lesson
This project has been funded with the support of the European Community. The contect of this project does not necessarily reflect the position of the European Community or the National Agency, nor does it involve any responsability on their part.