PHP HOME
PHP Introduction
PHP SETUP
PHP Syntax
PHP Data Types
PHP Outputs
PHP Variable
PHP Constant
PHP Strings
PHP Operators
PHP if else if
PHP Switch
PHP while loop
PHP for loop
PHP Arrays
PHP Functions
PHP Sorting Array
PHP Form Handling
PHP Form Validation
PHP Form Required
PHP Form URL/EMAIL
PHP Form Submit
PHP Contact Form
PHP DATE & TIME
PHP INCLUDE
PHP FILE HANDLING
PHP FILE OPEN/READ
PHP FILE CREATE/WRITE
PHP FILE UPLOAD
PHP SESSION
PHP COOKIES
PHP FILTER
PHP ERROR HANDLING
PHP EXCEPTION
PHP Redirects
PHP with MySQL
PHP WITH MYSQL DB
MYSQL CONNECT
MYSQL CREATE DATABASE
SELECT DATABASE
MYSQL CREATE TABLE
MYSQL INSERT DATA
MYSQL SELECT DATA
MYSQL UPDATE DATA
MYSQL DELETE DATA
MYSQL ORDER
MYSQL LIMIT
MYSQL LAST ID
In the middle of PHP programs, we can store temporary data through PHP variables. There is no need to declared a variable before assigning the value. PHP variable starts from the $ sign.
How to declare PHP Variable?
PHP Variable declare usign dollar sign ($)
How to use PHP Variable?
First declare a PHP variable then it call any place of page or another page where declare page already included.
<!DOCTYPE html>
<html>
<body>
<?php
$php_string = "This is a string";
$php_integer = 357;
$php_float = 5.201;
?>
<p>This is a PHP string variable example : <?php echo $php_string; ?></p></br>
<p>This is a PHP integer variable example : <?php echo $php_integer; ?></p></br>
<p>This is a PHP float variable example : <?php echo $php_float; ?></p>
</body>
</html>
The above code produces the following results
Outputs: This is a PHP string variable example: This is a string
This is a PHP integer variable example: 357
This is a PHP float variable example: 5.201