Wednesday, 28 October 2009

Day 2 - Hello world in php

I have seen many tutorials that start with php running under the apache. But for change I like to create the hello world application as a command line application. So this will show you that the php can also act as command line tool also.

Create a file with following content and name it as hello_world.php

echo 'Hello World!!!'.PHP_EOL;

To run it, in the command line
$ php hellow_world.php
Hello World!!!


Perfect you have made you first php hello world application. As part of the example you have noticed that you didn't complied your application to create a executable file. This is because php is not a compiler but its an Interpreter.

No comments:

Post a Comment