Loosely coupled Language
No need to define datatype, PHP automatically recognized
Print
print, printf, sprintf, echo
to print array
print_r, var_export, var_dump
gettype
its returns the datatype of the var
echo vs print
both used to print var value but echo is faster than the print because print is also the function. (echo is not the function so its not wait for the return type)
Include Files in PHP
include 'filename.php'; //Include File for the entire file, if file not found give warning message
include_once 'filename.php'; //Include File only once, if file not found give warning message
require 'filename.php'; //Include File for the entire life cycle of file, if file not found give fatal error message
require_once 'filename.php'; //Include file only once, if file not found give fatal error message
Note:-
In PHP6 only use require_once
Super Global Variables
All the super global variables are associative arrays
$_REQUEST[] -> Use this if don't know form type is get or post
$_GET[] -> use to get value from the URL, GET less data max size is 2000 kb
$_POST[] -> Use to send value from the page to another page, Get more Data max size is 8MB
$_SESSION[] -> Its contain server information
$_COOKIES[] -> Its store in local system
$_ENV[] ->
HTTP_HOST ->
HTTP_USER_AGENT ->
HTTP_REFRRER ->
SCRIPT_FILENAME ->
PHP_SELF -> recognize theirself wto here to go
SERVER_PROTOCOL ->
Constant / OFFSET
Never change, first needs to define
define ("LOGIN", $con);
$_SERVER['REFFRER'] is used to make file secure, used to make Login secure
PHP Errors
E_NOTICE ->
E_WARNING -> Give Warning Message
E_STRICT -> Show the error message, needs to follow strictly
E_ALL ->
E_ERROR -> Fatal Error, Program will not execute
DEPRECATED -> Shows particular functions are outdated
Display Errors On and Off
ini_set('display_errors', 'off');
ini_set('display_errors', '1');
error_reporting(~E_NOTICE);
notice(E_NOTICE);
To Access Error on particular line use @
PHP.inp File Settings
upload_max_size
upload_max_file -> 20
Max_file_size
post_max_size
short_open_tag
memory_limit
Maximum Execution time -> 30sec
Session Time -> 24 minute
Mysql Port
mysql_default_port -> 3306
Magic Constant in PHP
__FILE__ -> show the file path e.g. http://localhost/jpc/index.php
__DIR__ -> show the directory path e.g. C:\\wamp\www\jpc\
__LINE__ -> Its show the line number
__FUNCTION__ ->
__METHOD__ ->
__NAMESPACE__ -> Its tell about the working directory
Encoding Techniques
one way hashing ->
md5() ->
sha1() ->
two way hashing
base64_encode() ->
base64_decode() ->
url_encode() ->
url_decode() ->
No need to define datatype, PHP automatically recognized
print, printf, sprintf, echo
to print array
print_r, var_export, var_dump
gettype
its returns the datatype of the var
echo vs print
both used to print var value but echo is faster than the print because print is also the function. (echo is not the function so its not wait for the return type)
Include Files in PHP
include 'filename.php'; //Include File for the entire file, if file not found give warning message
include_once 'filename.php'; //Include File only once, if file not found give warning message
require 'filename.php'; //Include File for the entire life cycle of file, if file not found give fatal error message
require_once 'filename.php'; //Include file only once, if file not found give fatal error message
Note:-
In PHP6 only use require_once
Super Global Variables
All the super global variables are associative arrays
$_REQUEST[] -> Use this if don't know form type is get or post
$_GET[] -> use to get value from the URL, GET less data max size is 2000 kb
$_POST[] -> Use to send value from the page to another page, Get more Data max size is 8MB
$_SESSION[] -> Its contain server information
$_COOKIES[] -> Its store in local system
$_ENV[] ->
HTTP_HOST ->
HTTP_USER_AGENT ->
HTTP_REFRRER ->
SCRIPT_FILENAME ->
PHP_SELF -> recognize theirself wto here to go
SERVER_PROTOCOL ->
Constant / OFFSET
Never change, first needs to define
define ("LOGIN", $con);
$_SERVER['REFFRER'] is used to make file secure, used to make Login secure
PHP Errors
E_NOTICE ->
E_WARNING -> Give Warning Message
E_STRICT -> Show the error message, needs to follow strictly
E_ALL ->
E_ERROR -> Fatal Error, Program will not execute
DEPRECATED -> Shows particular functions are outdated
Display Errors On and Off
ini_set('display_errors', 'off');
ini_set('display_errors', '1');
error_reporting(~E_NOTICE);
notice(E_NOTICE);
To Access Error on particular line use @
PHP.inp File Settings
upload_max_size
upload_max_file -> 20
Max_file_size
post_max_size
short_open_tag
memory_limit
Maximum Execution time -> 30sec
Session Time -> 24 minute
Mysql Port
mysql_default_port -> 3306
Magic Constant in PHP
__FILE__ -> show the file path e.g. http://localhost/jpc/index.php
__DIR__ -> show the directory path e.g. C:\\wamp\www\jpc\
__LINE__ -> Its show the line number
__FUNCTION__ ->
__METHOD__ ->
__NAMESPACE__ -> Its tell about the working directory
Encoding Techniques
one way hashing ->
md5() ->
sha1() ->
two way hashing
base64_encode() ->
base64_decode() ->
url_encode() ->
url_decode() ->
No comments:
Post a Comment