Hello World

Getting Started with PHP
Getting Started with PHP : Home
Hello World
Data Types in PHP
Variables in PHP
Operators in PHP
Decision Making in PHP
Iterations in PHP
Functions in PHP
Arrays in PHP
Strings in PHP
Object Oriented PHP
Classes and Objects
Object Interfaces
Static and Final
Advanced Features in PHP
Session in PHP
Cookies in PHP
Server Variables

First PHP Program
We will start with a simple Hello World Program.

Hello World

    echo “hello world!!!”;

You can see the output of the file by clicking try now.
This code prints hello world!!!. Let's understand the code line by line

You will be able to understand this better with this code

<!DOCTYPE html>
  <h1><?php echo "title"; ?></h1>
  <p><?php echo "description"; ?></p>

Here we have ended PHP code in line 3 with ?> and code is again initiated in line 4.
Comments in PHP
Single line comments can be added in PHP code using // or #. Multiple line comments are added using /* comments */ Here is a code demonstrating comments in PHP

    //Here is a single line comment
    # There goes another comment
 echo "title"; 
 /* Want to see a multiline comment
 as you wish */

Login to Track Your Progress