there is a process for fixing the value of a variable that will not change. w" /> there is a process for fixing the value of a variable that will not change. w"/>
PHP Basic
Introduction to PHP PHP Starting Requirements Downloading XAMPP Local Server PHP Variable Concept and Data Type PHP Coding Syntax Showing Output in PHP PHP String Concatenation Increment & Decrement in PHP PHP Logical Operator and Usage Part-1 PHP Logical Operator and Usage Part-2 PHP Comparison Operators Arithmetic and Assignment Operators PHP Switch Case Statement For loop in PHP Super Global Variable $_REQUEST and $_GET Part-1 String Length in PHP Function Declaration and UsagePHP has also system for storing several types of values such as int, float, string, boolean like other programming languages. But the process of storing value in php is simple different. A user can easily store all types of value by using same syntax. For declaring variable in php it is need to use dollar($) sign with a word. After that it will be regarded as a variable.
For writing variable you should keep in mind some rules and regulations. Look below list before writing a variable in PHP.
Let's see some example written value for better clearance; $name is a variable where name is joined with $ sign. We can see some variables from the below list.
<!--?php
//lets see some variable declared below
$name = "Ariful Islam"; //Storing string value
$age = 22; //Storing integer value
$haveWebsite = true; //Storing boolean value
$currentTemperature = 29.6; //Storing float value
?-->
Go through the below table for knowing writing system of a variable in php
Variable Name | Sign | Store | Example |
---|---|---|---|
Name | $name | Character | $name = "John" |
Salary | $salary | float or double type data | $salary = 5999.43 |
Age | $personage | Integer | $personage = 25 |
Status | $status | Boolean (true/false) | $status = true |
We can see an comparing table where you will find the real difference with other language. We are comparing with Java and C
PHP | Java | C | JavaScript |
---|---|---|---|
$name="Adam" | String name = 'Adam' | char ='Adam' | var name = "Adam" |
$salary= 12000.554 | double salary = 12000.554 | double salary = 12000.554 | var salary = 12000.554 |
$salary = 1200.55 | float salary = 1200.55 | float salary = 1200.55 | var salary = 1200.55 |
$status = true | boolean status = true | bool status = true | var status = true |
If you think you have query... then For contacting with us use Facebook . You can also use Github