How to start coding in PHP with 'Hello world'

Start programming in PHP for beginners

How to start coding in PHP with 'Hello world'

Introduction

 

PHP is one of the most popular open-source and server-side scripting language. PHP is a powerful tool for making dynamic, interactive websites and you can do much more with it. It can be learned easily. It is also important to know PHP is an object-oriented programming language. PHP runs on different operating systems (OS), like Windows, Linux and supports different databases like MySQL, Oracle and many more. PHP can not only collect form data, but it can also create, read, write, delete, and close files on the server. PHP is a widely-used language for web development.

Let’s start with the syntax first, but before this you have to create a file with .php extension. Now write PHP code to output the text “Hello world” to a browser:

First of all you need to know how to start php code in how to end :

 

//start php
<?php 
.
.
.
.
?> 
//end php

 

Now you need a file to write this php code:

 

welcome.php

 

<!DOCTYPE html>
<html>
<head>
<title>Title of the page</title>
</head>
<body>

</body>
</html> 

 

After create this file insert php code:

 

<!DOCTYPE html>
<html>
<head>
<title>Title of the page</title>
</head>
<body>

<h1>
<?php 
echo 'Hello World'; 
?>

</h1>
</body>
</html> 

 

 

 

 

Top