␡
- Moving over to server-side
- HTML versus PHP
- Step 1: EasyPHPA simple tool for getting into PHP
- Step 2: Running EasyPHP
- Step 3: Writing your first few lines of PHP code
- Step 4: Posting your PHP code to the server
- Step 5: Doing more complicated things with PHP
- Conclusion
Like this article? We recommend
Step 3: Writing your first few lines of PHP code
In the grand tradition of running server-side code, you now have two more steps to perform before you can run your first piece of PHP code:
- Write some code.
- Place that code in a specific location.
Let's get the first step out of the way and create a file called hello.php. You can just copy the code in Listing 1. When you create the file, make certain that it has the .php filename extension.
Listing 1 Hello World from PHP
<html> <head> <title>PHP Test</title> </head> <body> <?php echo ’<p>Hello World</p>’; ?> </body> </html>
The Hello World file has to be copied into the www directory in the folder into which EasyPHP was installed.
You're just about there now! Let's run the code.