PHP Variable

Add Tool

A guide to Use PHP Variable


Personally I think PHP variable is used to work first. Specially it helps to display same things at various place by declaring variable. Use PHP Variable declared with $ sign. See the main structure of declaring variable.

$variable_name = value;

Use of PHP Variable

<?php 
$text = "My name is Masum"; 
echo "$text"; 
?>

Result: My name is Masum Here, I declare a variable as $text and value MY name is Masum and displayed it with echo. Actually echo is used to print or display through web browser. You can user PHP Variable more dynamically using PHP Operators list

Use Two PHP Variable :

<?php 
$text = "My name is Masum."; 
$age = "I am 27 Years Old."; 
echo "$text" . " " ."$age"; 
?>

Result: My name is Masum. I am 27 Years Old. About The Codes: Here I use two variable $text and $age and add some value My name is Masum. and I am 27 Years Old. and Finally I have Called the Two variable with echo "$text" . " " ."$age"; I also use Concatenation (.) and (" ") for giving a space between the two sentence. If you do not use concatenation between the two variables, you will mistake. You can user

Another Exampla of PHP variable with brake tag :

<?php
$text = "My name is Masum.";
$age = "I am 27 Years Old.";
echo "$text" . "<br/> " ."$age";
?>

Result: My name is Masum. I am 27 Years Old. Now Try to add many variable and print it with your own style.


Tags: concatenation, php variable, php array, global php, php static variable, php print all variables, variable global php, _get php, php variable definition
Payza

About Masum Billah

A guide to Use PHP Variable 1stWebSuite website seo tool is a free website ranking tool site provides a lot of on page and off page seo useful tools for you. On this site, we have a large number of website ranking tools


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: PHP Variable


adf.ly