Tuesday, 7 July 2015

The Building Blocks

Overview
In this hour, you are going to get your hands dirty with some of the nuts and bolts
of the language.
There's a lot of ground to cover, and if you are new to programming, you might feel
bombarded with information. Don't worry— you can always refer back here later on.
Concentrate on understanding rather than memorizing the features covered.
If you're already an experienced programmer, you should at least skim this hour's
lesson. It covers a few PHP-specific features.
In this hour, you will learn
About variables— what they are and how to use them
How to define and access variables
About data types
About some of the more commonly used operators
How to use operators to create expressions
How to define and use constants
Variables
A variable is a special container that you can define to "hold" a value. A variable
consists of a name that you can choose, preceded by a dollar ($) sign. The variable
name can include letters, numbers, and the underscore character (_). Variable
names cannot include spaces or characters that are not alphanumeric. The following
code defines some legal variables:
$a;
$a_longish_variable_name;
$2453;
$sleepyZZZZ
Remember that a semicolon (;) is used to end a PHP statement. The semicolons in
the previous fragment of code are not part of the variable names.
NEW
TERM
A variable is a holder for a type of data. It can hold numbers, strings of
characters, objects, arrays, or booleans. The contents of a variable can
be changed at any time.

No comments:

Post a Comment