Friday, 28 June 2013
create a simple program usig php variable
Hello friends yesterday I told about how to install Apach using XAMPP Server .You can easy access your files via http://localhost/phpmyadmin/programname.php If your file is in PhpMyAdmin Directory.
Also you can access your file via http://localhost/phpmyadmin/foldername/programname.php If your file is saved in Your own folder, The second method is very usefull for creating a php based projects.
Let start to create a simple program usig php variable.
<html>
<head>
<title>My First Php Program</title>
</head>
<body>
<h2>Demonstrates using General H1 Tage</h2>
<div><h3>dreamtheweb.com </h3>
<h2>Demonstrates using a variable</h2>
<div>
<?php
$name= "dreamtheweb.com";
print "welcome to, $name";
?>
</div>
</body>
</html>
Save it as myphpprogram.php
out put

The line $name = “dreamtheweb.com”; does two major things. First it creates a new variable named
$name and the second is it will assign the value “dreamtheweb.com” to the variable. In PHP Language , all variables start with a $ (dollar sign ) and the The variable’s name is user defint one except some rools. The assignment symbols (=) is generally used for assignment operations.
The next one is printing a variables value ,If you want to print the value of a variable, simply place the variable name in the text you want printed.
Ie following line:
print “welcome to , $name”;
It actually produces the output:
Welcome to, dreamtheweb.com (Look fig ph1) That its.
The next section we will discuss about displaying word or text using somr other way …
So please keep dreamtheweb.com daily …
Also you can access your file via http://localhost/phpmyadmin/foldername/programname.php If your file is saved in Your own folder, The second method is very usefull for creating a php based projects.
Let start to create a simple program usig php variable.
<html>
<head>
<title>My First Php Program</title>
</head>
<body>
<h2>Demonstrates using General H1 Tage</h2>
<div><h3>dreamtheweb.com </h3>
<h2>Demonstrates using a variable</h2>
<div>
<?php
$name= "dreamtheweb.com";
print "welcome to, $name";
?>
</div>
</body>
</html>
Save it as myphpprogram.php
out put
The line $name = “dreamtheweb.com”; does two major things. First it creates a new variable named
$name and the second is it will assign the value “dreamtheweb.com” to the variable. In PHP Language , all variables start with a $ (dollar sign ) and the The variable’s name is user defint one except some rools. The assignment symbols (=) is generally used for assignment operations.
The next one is printing a variables value ,If you want to print the value of a variable, simply place the variable name in the text you want printed.
Ie following line:
print “welcome to , $name”;
It actually produces the output:
Welcome to, dreamtheweb.com (Look fig ph1) That its.
The next section we will discuss about displaying word or text using somr other way …
So please keep dreamtheweb.com daily …
0 comments:
Post a Comment