Thursday 21 May 2009

Chapter Summary

Defining strings in your programs three different ways: with single quotes, with double quotes, and as a here document.
Escaping: what it is and what characters need to be escaped in each kind of string.
Validating a string by checking its length, removing leading and trailing whitespace from it, or comparing it to another string.
Formatting a string with printf( ).
Manipulating the case of a string with strtolower( ), strtoupper( ), or ucwords( ).
Selecting part of a string with substr( ).
Changing part of a string with str_replace( ).
Defining numbers in your programs.
Doing math with numbers.
Storing values in variables.
Naming variables appropriately.
Using combined operators with variables.
Using increment and decrement operators with variables.
Interpolating variables in strings.

Join Free Now : PHP Tutorial

Variables

Variables hold the data that your program manipulates while it runs, such as information about a user that you've loaded from a database or entries that have been typed into an HTML form. In PHP, variables are denoted by $ followed by the variable's name. To assign a value to a variable, use an equals sign (=). This is known as the assignment operator.

$plates = 5;

$dinner = 'Beef Chow-Fun';

$cost_of_dinner = 8.95;

$cost_of_lunch = $cost_of_dinner;


Assignment works with here documents as well:



Join Free Now : http://php.baggyspace.com