Site Meter Web Dev Notes » Blog Archive » Your First PHP Page

Your First PHP Page

by Deceth

So far, I’ve introduced several open source applications built with PHP such as Joomla, PHP-Nuke and phpBB. I’ve also posted a brief introduction to PHP, which links to some useful tutorials and resources that will help you get PHP installed on your computer if you wish to test locally. All this information is a bit much to swallow all at once, so today, I want to get started right at the very basics and make a very simple PHP page.

There are tons of great tools available for developing code. My personal favorite is the most simple of all; Notepad! Notepad is a great tool for writing code because it doesn’t do anything for you. While this makes debugging difficult, it makes sure you learn your code better and understand what it is doing. I wouldn’t recommend Notepad for large projects, but for quick edits or simple pages, Notepad is a great tool which opens instantly and uses virtually zero resources.

Today we are going to write a simple program which displays, “Hello World!” on a website. Nothing too fancy, but it is the traditional starting point in just about every programming language I have tackled!

Open up Notepad:

<html> <head> <title >Hello World PHP Page!</title> </head> <body> <h1>Hello World PHP Page!</h1> <p> <?php echo "Hello World"; ?> </p> </body> <html>

Save the file with a .php extension. (ex: index.php or hello.php). Upload it to your web server and you are done!

Most of the above code is just basic HTML code for setting up a web-page. The PHP code begins with the “<?php” tag and ends with the “?>” tag. Everything between these tags is interpreted by PHP. “echo” is a simple PHP function which prints text to the screen. What you have therefore done with the simple code above it setup a web-page which includes PHP code to display the text, “Hello World!”. Try it out!


2 Responses to “Your First PHP Page”

  1. Web Dev Notes » Blog Archive » Formatting Text in Wordpress Says:

    [...] Formatting Text in Wordpress April 20th, 2007 by Deceth I’ve received several questions relating to yesterday’s tutorial, “Your First PHP Page” in regards to how I was able to include HTML code in my post. For example, if you want to make a word bold, you type <strong>bold</strong>. So the question is, how then did I write <strong>bold</strong> without the word becoming bold? The other questions I’ve been asked is, “How the heck did you do that indentation?!”. [...]

  2. Web Dev Notes » Blog Archive » Hello World in JavaScript Says:

    [...] Hello World in JavaScript May 7th, 2007 by Deceth Last month I introduced some basic PHP code which allowed text to be printed to the screen. If you do not have PHP enabled, you can do the same thing with JavaScript! The simple script shown below will once again display the classic “Hello World” text to the screen. Place the below script in your HTML page where you would like the text displayed. <script language=”javascript” type=”text/javascript”> document.write(’<b>Hello World</b>’); </script> Posted in General, Client-Side Scripting, JavaScript Link to this Entry Email This Entry [...]

Leave a Reply


About Web Dev Notes

Your one stop destination for anything and everything related to web development

Web Dev Notes Author(s)
    » Deceth

Blogging Flair

New Media, Web 2.0 Channel Posts

  • Podcasting Transcription
    A Guest Post from Tishia Lee of Tishia Saves Time: When I first started offering transcription services as part of my Virtual Assistant business, transcribing podcasts was not something I [...]
  • Don't Dabble - Make A Commitment
    If you want to get the best bang for your buck, plan on podcasting for the long haul. Podcasters who “test” things out with one or two podcasts and then give up may think that they've given [...]
  • A Question of Podcasting Frequency
    This follows up on yesterday's post about not dabbling in podcasting but rather to make a commitment. Podcasting on a schedule is important when building a community and an audience. Don’t have [...]
  • Do You Twitter About Your Podcast?
    Whenever I release a new episode of Work at Home Moms Talk Radio is pop the link up on my Twitter and invite my followers to come check it out. This has brought me several first time listeners which [...]
  • Looking for Podcast Outsourcing?
    I mentioned having my podcast audio's transcribed in my last post. In case you wonder - no, I do not transcribe them myself. (Shudder the thought - I did enough transcription to last a lifetime in [...]
  • Business Podcasting Benefit: Be An Industry Thought Leader
    I often ask people 'Why haven't you started your podcast yet?' and a common reply is 'I don't feel like I'm enough of an expert to cover the topic I'm interested in.' Enough of an expert? [...]
  • Business Podcasting Benefit: More Content
    Building a business on the web requires that you generate a lot of content. Content on your website draws traffic both through search engines (people searching for your content) and through links [...]
  • Business Podcasting Benefit: Deeper Relationships
    A website visitor is just a website visitor. You can't really say that you have a relationship with someone who has only visited your website can you? But when the web visitor subscribes to [...]
  • Business Podcasting Benefit: Increased Market Exposure
    When you consider how many millions of people are walking around with iPods and other Mp3 players you have to wonder, wouldn't it be awesome if they came looking for you? Well they do. Ipod [...]
  • D'ya Know Your Podcasting ABCs?
    I embarked on a fun little project this winter in which I have been working my way through the alphabet, looking for words for each letter that I could apply to the subject of podcasting. I've [...]

Hot Off The Press

  • Flip Mino
    If it is one thing you don't need when you have kids is more "things". You carry around a diaper bag, juice boxes, changes of clothes, a camera and for special occasions you bring out the [...]
  • Paris slams another report again. Yes, again!
    You read it right. If you think it’s quite odd that every now and then Paris Hilton just kept on denying issues thrown at her, then be prepared for another denial. Like somebody totally fed [...]
  • What's up for Paul Dano?
    I caught Little Miss Sunshine on cable TV early this week and wondered what's been going on with Paul Dano's career. He was touted as one of Eentertainment Weekly's successful people under 30 years [...]
  • Happy Live Show Day!
    Good Morning, Hamster Lovers! It's our first live show day! I'm so EXCITED! AGP has really stepped it up with this cast, and the two shows so far - I'm extremely pleased so far, and can only hope the [...]
  • Rihanna is stunning in yellow
    Not everybody could wear a yellow dress! That’s the sad fact I learned spending the whole day today looking for the perfect yellow dress. ‘Guess I really owe to be jealous to those who [...]
  • Testing, Testing...
    Hello all. Today I have decided to not only test out Skribit but to give you the chance to have a bit more say about the things you would like to see more of on this site. I'm going to leave this up [...]
  • Paris Hilton pregnancy rumors: Not Yet Over!
    When Paris Hilton went out with her boyfriend, Benji Madden with an alleged baby bump, everybody (at least for those who care) seems to have waited for a confirmation. However, the confirmation [...]
  • Rumer Willis needs a bra, badly!
    While I have nothing against those who feel more comfortable without a bra, I certainly think Rumer Willis case is different. Attending the Power of Paws launch party yesterday, Rumer shows [...]
  • Invalid food - or was that food for invalids?
    I'm still not well. I've finally taken a deep breath and said "I can't do all the work I want to do this week – so let me prioritise." All the rest of this week will be what I like to think [...]
  • Microsoft Copies Nintendo
    I really hate when a company tries to copy a novel and popular idea as a means of cashing it. It never works as well and usually is half assed and poorly supported. Case in point, the motion [...]