Beruflich Dokumente
Kultur Dokumente
ON
***************************************************************************
Contents
• 1 History
○ 1.1 Licensing
○ 1.2 Release history
• 2 Usage
• 3 Security
• 4 Syntax
○ 4.1 Data types
○ 4.2 Functions
4.2.1 PHP 5.2 and earlier
4.2.2 PHP 5.3 and newer
○ 4.3 Objects
4.3.1 Visibility of properties and methods
• 5 Speed optimization
• 6 Compilers
• 7 Resources
• 8 See also
• 9 Notes
• 10 External links
1. PHP
PHP stands for P HP: H ypertext P reprocessor
PHP is a server-side scripting language, like ASP
PHP scripts are executed on the server
It is free to download and use
It is an open source software
2. ADVANTAGES
Open Source, readily available and dual-licensed
Very Easy to understand Syntax
Interfaces very easily with Apache/MySQL
Pretty easy to access other web-based tools through PHP (i.e. google maps,
etc.)
It's available with documentation in many languages.
3. Disadvantages
PHP tends to execute more slowly than assembly, C,
and other compiled languages.
PHP is loosely typed.
Web programming is open to security flaws due to
unimplemented or unknown vulnerabilities, takes a bit
more caution.
4. How PHP Works? When a user navigates her browser to a page that ends
with a .php extension, the request is sent to a web server, which directs the
request to the PHP interpreter. The PHP interpreter processes the page,
communicating with file systems, databases, and email servers as necessary,
and then delivers a web page to the web server to return to the browser.
5. PHP FILES
○ PHP files can contain text, HTML tags and scripts.
○ PHP files are returned to the browser as plain HTML.
○ PHP files have a file extension of ".php",
".php3", or ".phtml"
○ PHP code is executed on the server, and the plain HTML result is
sent to the browser.
○ A PHP file contains HTML tags and some PHP scripting code.
7. Basic Rules:-
Each code line in PHP must end with a semicolon .
The semicolon is a separator and is used to distinguish one set of instructions
from another.
There are two basic statements to output text with PHP:
In the eg we have used the echo statement to output the text "Hello World".
Note: The file must have a .php extension. If the file has a .html extension , the PHP
code will not be executed.
2. Comments in PHP:
In PHP, we use // to make a single-line comment or /* and */ to make a large
comment block. <html><body> <?php -> Single-line Comment -> Large Comment ?
> </body></html> //This is a comment /* This is a comment block */
3. VARIABLES IN PHP
* Variables are used for storing information values, like text strings, numbers
or arrays.
* When a variable is declared, it can be used over and over again in
your script. * All variables in PHP start with a $ sign symbol.
4. The Settings in which upload directory, register global variables, display errors, log
errors, max uploading size setting, maximum time to execute a script and other
configurations is written in this file. When PHP Server starts up it looks for PHP.ini file
first to load various values for settings.
IF ELSE
IF (conditional statement)
{ [code if condition is true] }
ELSE
{ [code if condition is false] }
24. Include INCLUDE ("external_file_name");
SWITCH ($variable)
{ CASE 'value 1':
[code to execute when $variable = 'value 1']
break;
CASE 'value 2':
[code to execute when $variable = 'value 2']
break;
CASE 'value 3'
: ...
DEFAULT:
[code to execute when none of the CASE values matches $variable']
}
WHILE Loop
WHILE (expression)
{ [code to execute] }
25. THANK YOU