PHP variables

Some practice with variables
First, we’ll take a look at how to display what’s in your variables. We’re going to be viewing our results on a web page. So see if you can get this script working first because it’s the one we’ll be building on. Using a text editor like Notepad, or your PHP software, type the following. (You can copy and paste it if you prefer. But you learn more by typing it out yourself – it doesn’t sink in unless you’re making mistakes!)


When you’ve finished typing it all, save the page as practice.php. Then Run the script. Remember: when you’re saving your work, save it to the WWW folder.


To run the page, start your browser up and type this in the address bar:

Or this:


If you’ve created a folder inside the www folder, then the address to type in your browser would be something like:

Add the following lines in your code:


We’ve set up a variable called $test_String. After the equals sign, the text “It Worked!” has been added. The line is then ended with a semi-colon. Don’t run your script yet. Change the Print line to this:


One thought on “PHP variables

  1. Nice post. I used to be checking continuously this blog and I am inspired!
    Extremely useful information specifically the remaining phase :
    ) I maintain such information much. I was looking for this certain info
    for a long time. Thanks and good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *