Page 33 - Open Soource Technologies 304.indd
P. 33
Unit 2: Language Basics
/* Notes
Vineet
December 20091
ZetCode
*/
/* */ delimiters are used to provide C style comments in PHP.
<?php
// PHP code
?>
The <?php and ?> delimiters are used to delimit PHP code in a file.
Keywords
A keyword is a reserved word in the PHP programming language. Keywords are used to perform
a specific task in the computer program. For example, print a value, do repetitive tasks or perform
logical operations. A programmer cannot use a keyword as an ordinary variable.
The following is a list of PHP keywords:
abstract and array() as break
case catch class clone const
continue declare default do else
elseif enddeclare endfor endforeach endif
endswitch endwhile extends final for
foreach function global goto if
implements interface instanceof namespace new
or private protected public static
switch throw try use var
while xor
The following is a list of PHP compile time constants.
__CLASS__ __DIR__ __FILE__ __FUNCTION__
__METHOD__ __NAMESPACE__
Next we have other language constructs.
die() echo() empty() exit() eval()
include() include_once() isset() list() require()
require_once() return() print() unset()
2.2 Data Types
A data type refers to the type of data that a variable can store. PHP has eight different data types
you can work with. These are:
• Integer numbers
• Floating point numbers
LOVELY PROFESSIONAL UNIVERSITY 27