Visit the Official PHP Website
Search this Site

PHP Programming

By James N Hitz

Back to Variables aka Scalars

You've just learnt that PHP variables are... "little boxes" in the computer's memory that are given a name and a value. The value is assigned using the assignment operator (=).

Even though there are no different variables according to data type, we said that the PHP variables will define themselves accordingly depending on the data assigned. The data could be:

  1. Integers - These are whole numbers eg 21, 34, -34
  2. Floating Point Numbers - Numbers with fractions eg 21.785, 34.00, -1.23e4
  3. Strings. This is alphanumeric data not intended for calculations eg "Motor Car", "Solomon", "1795", "Omwanango". Strings are enclosed in double quotes.

Integers, Floating Point Numbers and Strings are called scalars. This means that they only can retain ONE value. It is also possible to have arrays. An array is a collection of several things. We will get into this later.

In the mean time we consider Data Conversion and Type Jugling - these allow users to change a value to either a string, a floating point number or an integer. Sounds like fun. True? Ok Maestro... Clowns we become!

<< Common Operators | Type Juggling Clowns >>