PHP for beginners – Chapter 5

Welcome Back, Now we are going to learn Chapter 5 from PHP for beginners.

In this chapter, we will start coding in PHP. 🙂

We will start from “Hello world” example.

Open any editor. To choose editor – check our post for it. PHP for beginners – Chapter 2

Create a new file test.php

Write following code :

<?php

echo “Hello world!”;

?>

Save this file.

To run this file. first you have to start apache server. I hope you have read our article on this. PHP for beginners – Chapter 3

Start apache server. Place this file into htdocs folder. after starting your apache server.

Open your browser and type http://localhost/test.php

you will see output “Hello world”.

Now, we will see some more example for loops. Suppose we want to print 1 to 10 numbers.

<?php

for($i = 1; $i<=10;$i++) {

echo $i.”<br />”;

}

?>

This output will be :

1

2

3

4

5

6

7

8

9

10

You can learn more about php operators, loops, functions, strings and all from w3schools.com 

I hope this article will help you to start coding in php.

Author: Jaydip Panchal

Hello, This is jaydip panchal here, who do code, dream code, eat code, drink code, walk code. #CodeWithJaydip #CodeWithGeek

Leave a Reply

Your email address will not be published. Required fields are marked *