|
|
|
PHP: PHP Hypertext Preprocessor
PHP is a server-side scripting language where the code is executed in the server. Other server-side programming languages include ASP, JSP etc.
UNIT V CONTENTS
PHP Introduction, Creating PHP Script, Running PHP Script, Variables & Constants, Data types, Operators.
UNIT VI CONTENTS
PHP Conditional Statements & Control Statements, Arrays, Functions, Working with forms and database using MySQL.
PHP Introduction
- PHP stands for PHP: Hypertext Preprocessor.
- It is a server side scripting language like ASP, JSP and the scripts run in the server.
- PHP is an open source software and is free to download and use.
- It is compatible with many databases such as MySQL, Oracle, Sybase, and other popular DBMS.
- PHP runs on all platforms (Linux, Windows etc) and is compatible with almost all servers used today (Apache, IIS, etc).
- It is easy to learn and runs really efficient on the server side.
- PHP code can be embedded in the HTML code like javascript.
- Extension of PHP files can be .php, .php3 or .phtml
Creating & Running PHP Script
PHP Variables & Constants
- PHP variables start with $. For example, $name = "Suresh Mudunuri", $i=55 etc.
- More Information on PHP Variables can be found @
- Constants are variables whose values can not be changed. Constants in PHP can be created using the define statement. Example, define(PI, 3.14); echo PI; - This statement will print 3.14
PHP Data Types
- PHP supports data types that are similar to JavaScript. But, broadly they can be categorized to 3 types - Numeric, String and Array.
- Numeric: PHP variables can hold data of all types of numbers like integers, floating point values etc.
- Strings: Strings are used for holding characters and text.
- Arrays: Arrays store multiple values in a single varaible. PHP Arrays are of 3 types - Numeric, Associative (ID, Key pairs) and Multi-Dimensional Arrays.
- Information about the PHP data types can be found @
PHP OPERATORS
- PHP supports The following operators:
- Arithmetic (+, -, *, /, %, .)
- Assignment (=, +=, *=, .=, etc.,)
- Increment/Decrement (++, --)
- Relational (==, >, <, <=, >=, !=) Special:===, !==, <> (Not equal to)
- Logical (&&, ||, !) Alternates:and (&&), or (||)
- Array Operators: + (union), == (equality), === (identity), != / <>(inequality), !== (non-identity)
- More information about PHP operators can be found @
PHP Conditional & Control Statements
- PHP supports The following conditional statements:
- If statement
- If-else statement
- If-elseif-else statement
- Switch statement
- While Loop
- Do-While Loop
- For Loop
- For-Each Loop
- Information about the usage of PHP Coniditonal Statements can be found @
PHP Functions
|