Variables

28.4.1. Variables

Variables are those elements that are given variable values, depending on the case. Here is an example:

<? (1)
if ($foobar == 1)){ (2)
 echo "The value is 1"; (3)
} else {
 echo "The value is not 1"; (4)
}
?> (5)
(1)
As with every PHP script, we have to designate its start and end. Here is the start...
(2)
We check if the foobar variable has the value 1.
(3)
If it does, we output a message. We do this with the echo function. This functions will print whatever is included in the double quotes. The double quotes may contain other variables (in which case the echo command will print their values), HTML code etc. If you want to print double quotes, you have to escape them with a backslash.
(4)
If it doesn't, we also output an aproppriate message.
(5)
...and here is the end of the script.

See also PHP variables.

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 337,305,818
  • Today: 5,509
Server InfoServer Info
  • Sep 24, 2017
  • 01:26 am PDT
 
 

Daily Inspiration