abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

5/22/2018

How to define PHP variable & use in html


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.

An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...