Last tutorial we know "How to create a php file". Now we will know how to write php code. Now we open our firstfile.php in text editor. Generally in html file we write this code :
---------------------------------
<html>
<head>
</head>
<body>
</body>
</html>
------------------------------------
This is html code. But php is a server site scripting language. In source code the html code is showing. But php code cannot show. Because it is server site scripting language. The php code is :
----------------
<?php
?>
---------------
First we write < (less then) sign, then write ? (interrogation) sign and write "php". It is starting code in php. In last we write ? (interrogation) sign and > (Getter then) sign. It is ending tag of php code. We also write this code for php :
---------------------
<?
?>
---------------------
Now we write this code in our file :
---------------------
<?php
echo "This is first php code";
?>
---------------------
Here echo is the php syntext.
Now open the browser. and refresh the page. We see our text in browser.
Write Php code in Php file |
Next tutorial we will know "How to create a index.php file and write php code".
No comments :
Post a Comment