Hi,
PHP how to
define variable in PHP
Generally use
$ symbol to variable some cases const or global is use for global use of
variable within file.
What is
variable : variable is entity or say object where user can store information or
use for such as number, character, string.
Eg:
$ab
=100; this is number or constant form of
variable .
$ab = ‘hi’
set of character get string.
$ab =’10.256’
storing float number.
$ab =’<div><p>HI
Hello how are you</p></div>’;
Above html
code pass into variable so that it can easily call html or reference to number
of pages.
Eg: in one file pass php code & you need
this variable to another pages , then call php
By <?php
include ‘ab.php’; ?>
&
<html>
<body>
<?php echo
$sqrt; ?>
</body>
</html>
In above case
pass variable in html code & result is in ab.php file $sqrt variable.
Suppose you
are connecting to mysql database for getting data. Then call connection &
get value in one variable of php file & call it in any number of file i.e.
reference passing.
Simple
addition program of Variable .
<?php
$a = 10 ;
$b = 50;
$c = $a +$b;
echo $c;
?>
In above code
output is 60 a & b variable pass to c variable & echo output result.
Note:
Semicolon is necessary for each line.
Thanks for viewing blog send comment in case any query.
Thanks for post:
ReplyDeleteship nhanh sang Mayotte
ship tốc độ sang Chad
chuyển phát tốc độ tới Togo
THANK YOU FOR THE INFORMATION
ReplyDeletePLEASE VISIT US
Seo Services in Bangalore