Portability
PHP is designed to run on many operating systems and to cooperate with many servers and databases. You can build for a Unix environment and shift your work to NT without a problem. You can test a project with Personal Web Server and install it on a Unix system running on PHP as an Apache module.
Variables
A variable is a special container you can define to hold a value. Variables are fundamental to programming.
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.
PHP is loosely typed, which means it calculates data types as data is assigned to each variable.
Six standard data types available in PHP.
Type Example Description
Integer 5 A whole number
Double 3.234 A floating-point number
String "hello" A collection of characters
Boolean true One of the special values true or false
Object class Item
{ var $name = "item"; }
$obj1 = new Item();
$obj2 = new Item();
$obj1->name = "widget 5442";
print "$obj1->name<br />";
print "$obj2->name<br />";
Array $membertypes = array ("regular", "regular", "regular", $regular"); "Arrays"
Special Data Types
Type Description
Resource Reference to a third-party resource (a database, for example)
NULL An uninitialized variable
No comments:
Post a Comment