Create and Run the Hello World Program in PHP
PHP programs can be written in a very easy manner, follow the below two steps to create and run the program.
1. Open a text editor, write the following "Hello World" program and save the file with .php extension i.e. HelloWorld.php
Hello World Program - HelloWorld.php
<?php
class HelloWorld {
public function greetings() {
echo("Hello World");
}
}
$obj = new HelloWorld();
$obj->greetings();
2. Run the php file (i.e. php program) using the command php HelloWorld.php.