search
top

Basic PHP – Assigning Values to Variables

Adding values to php variables is simple as the following examples shows

The example code above will add the value Bobby to the variable $name and 30 to the variable age. You can print the value of the variable out to the browser by using the echo statement as follows.

Further to this we could add this html to a page.

Hi my name is ; and my age is 

This will print out Hi my name is Bobby and my age is 30

Related posts:

  1. Basic PHP – The Hello World Program
  2. Getting The Last Auto Increment Field With PHP
  3. Basic Windows Security
  4. Connecting to MySQL with PHP

Leave a Reply

top