- SEO TOOLS
- Webmaster Tools
You can write PHP code in a text editor or use web development software like Adobe Dreamweaver. Remain that PHP code does not active without server. Firstly you can use local server. Please learn about local server and setup it in your computer. Now create a page as heloword.php in your server directory and write the below HTML code.
<html> <head> <title>My PHP First code</title> </head> <body> </body> </html>
Now browse this file with a web browser with your directory link. (If you use Localhost than type http://localhost/your_directory folder name in your web browser’s address bar and press enter. You will see your created file heloword.php and if you use your remote server then visit http://www.your-domain-name/your-directory folder name.). You will see nothing because we don’t write any word in our body tag. Now try to add some PHP code in the body tag to display “This is my first PHP code practice.” Don’t afraid it is simple to display. See the below code her I have added this word “This is my first PHP code practice.”
<html> <head> <title>My PHP First code</title> </head> <body> <?php echo "This is my first PHP code practice."; ?> </body> </html>
Now reload your web browser you will see our targeted sentence. If you see carefully, you will notice we add our text or sentence in our body tag with some PHP coed. Here,
|echo||echo or print is used to display any things in browser|
|" "||Our words will be placed between this sign or contusion|
|;||Use this sign at the end of line|
Now try to add two paragraphs using the above structure. Are you unable to add 2 paragraphs? Ok, I have given another example to add 2 paragraphs but you should try to add 3, 4 or more paragraphs. See the below structure and try yourself.
<html> <head> <title>My PHP First code</title> </head> <body> <?php echo "This is Paragraph-1"; echo "<br/>"; echo "This is Paragraph-2"; ?> </body> </html>
To see the result you should follow the above instruction. Here I have used
<br/> tag for line break.