PHP
PHP is a powerful server scripting language for dynamic and attractive web pages.
PHP is free and widely used scripting language.
Echo and print statement
In PHP to output a data echo and print statement is used
Echo and print both provides the same output
echo can be used wih or without parentheses
echo or echo ()
echo statement ends with semicolon “ ; ”
Data type
PHP supports following data types
Integer
String
Float
Boolean
Array
Object
Null
Resources
PHP Operators
- Arithmetic
- Assignment
- Comparison
- Increment/Decrement operators
- Logical operator
- String
- Array
- Conditional assignment
PHP Switch
Switch statement is used to select one block of many blocks of code to be executed.
Like there are many codes to be executed but switch statement will provide us to chose one of them if condition satisfies.
PHP Functions
A function name must start with a letter or _ function names are not case sensitive
Example
function functionname() {
code to be executed;
}
PHP Superglabals Variables
Superglobal variables are built in variables that are always available
$_SERVER
$_SERVER is a super global variables which holds information about headers, paths and script locations.
$_REQUEST
$_POST
$_GET
$_FILES
$_ENV
$_COOKIE
$_SESSION
Forms in PHP
The form is enclosed in form tags
<Form method=“get” action=“path/to/submit/
page”
>
<!–- form contents –>
</Form>
Explaining Form Tags
action= “path/to/submit/
page”
is the page where form data is submitted
method= “get” is the method which is used to submit form data. There are two methods to get form data “get” and “post”
Leave a Reply