Вы находитесь на странице: 1из 1

<? Php ?

>
Start

Echo
Output Print

doesn't effect on script include "fileName.exe" $Name


Variables
connect to another file include_once "fileName.exe"
fatal error if it's incorrect,
effect on script require "fileName.php" " " . " "
Concatination
require_once "fileName.php"
control structure
switch(expression){
case " " :
#code... //This Is A Single Line Comment
break; /* This Is A Double Line Comment*/
default : //no case is true Comment
} #This Is Unix Shell Comment

current directory dirname(__FILE__); Gettype($var);


1.string
file_exists($file); Vardump($var); Length

FILE_APPEND Gettype($var);
file_put_contents($file or $directory ,data ,mode Vardump($var);
exclusive LOCK_EX mode |another ); 2.integer Length
FILE_USE_INCLUDE_PATH 3.float(double )(Real Number)
file_get_contents(file path,include_path,context,offset ,Max_ Datatype 4.array( , "A"=>"value" , ,);
length);
5.null (Empty)
is_writable('file path');
6.class And Object
Mkdir('folder name'); make a directory(folder)
7.(resourse) Mysqli_connect();
rmdir('folder name'); remove directory(folder)
8.(resourse) Fopen(filename, Mode);
IS_dir('folder name'); check
to get the file name basename(path ,suffex);
Define(name ,Value ,Case-insensitive);
to change the file mode to read only or 0755 write only ,r+ chmod($file , 0444);
Const $Name
copy(__FILE__, __DIR__.'/Backup/Backup_one.php'); copy(old file ,new file);
False (Default)
rename(old file ,new file); Costants Case-insensitive
True
pathinfo(path , info);
File System
Can't Be Changed Or Update
must be writable
unlink(file name , context);
remove file
show files scandir(dir , sort type ,context);
If Elseif Else

And = $$
Fopen(file name ,mode ,include_path ,context);
Xor One Condition Is True But Not All
fopen(file name); handle
fread(handle ,byte length); Logical Operators Or =||
filesize(file name); length
Not Equal >> !
write in a file fwrite(handle , String ,length);
pointer in the file(for modification)
@ Ignore Errors
SEEK_SET fseek(handle , offset ,whence);
Error Message @ Fopen() Or Die("file Is Not Exist");
SEEK_CUR whence
Include( " Inc .Php"); New Page Will Be Opened
SEEK_END Error Operator
Die() Method To Control The Exception
close the file fclose($file Handel);
error_reporting(number errors you want to show);

Globals['name']
Globals .
can be accessed in any where Concatenation
String Operator .=
getting information about the host

$_server['PHP_SELF'];

$_server['SEVER_ADDR']; For($i=0 ; $I < ; $I++){#code...}


Count($name);
$_server['SEVER_NAME']; Server
For Loop $Arr[index];
print info after ? $_server['QUERY_STRING'];
indexed arrays foreach($array as $value){}
what's the first page $_server['HTTP_REFERER']; foreach
associative arrays foreach($array as key $key => $value){}
$_server['SEVER_PORT'];
$_GET['name']; Predefined variables
GET While( Excepresion) { #Code.. }
getting inforamtion from database
While Do{ #Code...}while(excepresion);
Sending information to database
Post
$_POST['name'];
collect data from the form function + name( arguments ){ #code..}
Request
$_REQUEST['name']; calling with function name

‫ﺍﻟﺳﻳﺭﻓﺭ ﺑﻳﻧﺯﻝ ﺍﻟﻣﻠﻑ ﻓﻲ ﺟﻬﺎﺯﻙ ﺑﻳﻌﺭﻑ ﺍﻟﻣﻭﻗ ﻊ ﻋﻠﻳﻙ‬ return object; doesn't print value

saving your own information return null==void


functions
function must have return
setcookie(name,value,expire(when it's end) ,path,domain ,
cookies
secure,httponly); arguments may have default values

$_COOKIE rand(start value ,end value);

setcookie(name ,value,time() - 3600); delete

indexed
‫ﺗﺳ ﺟﻳﻝ ﺍﻟﺑﻳﺎﻧﺎﺕ ﻓﻲ ﻣﺗﻐﻳﺭﺍﺕ ﻋﻠﻰ ﺍﻟﺳﻳﺭﻓﺭ‬
start or resume session_start(); array within array
multiDiminsion
$_SESSION['name anything']; nestead foreach loop

every new page contain start_session(); print_r($array name ); print as structure

1.session_start(); Session $name[ ]="a","s","w";

2.session_unset(); (unset data) destroy $name[3]="php";

3.session_destroy(); count($name); array length

$_SESSION['counter']; simple counter array( "key" => "value");


Associative
key instead of index(unique)
make delay execution sleep(seconds)
In_Array(needle ,HayStack,false)
usleep(micro second);
search(0,1) Array_search(needle ,haystack)
make delay after 5 second time_sleep_until(time() +5 );
does't execute any code after that exit(); Misc functions Array_key_Exists(key,$search)

error control && like exit(); die(message); Array_push($arrayName,value1,value2); in the end


Add item
Arrays Array_unshift($arrayName ,value1); in the front
unique identifier uniqid(prefix ,more_Entropy );
array_pop($arrayName); from end
remove
array_shift($ArrayName); front
User Input
sort_regular
Cookies sort($arrayName , sorting Type);
sort_String
Web Service can filter
rsort( ); reverse don't change the index
Server Variables Sorting
asort($arrayName ,Sorting type);
Database query result for value
arsort($arrayname ,Sorting type);
array contain all filters filter_list();
associative array
filter_var(variable,filter type,option); ksort($arrayName ,Sorting type);
for keys
FILTER_SANITIZE_STRING(NUMBER_INT,EMAIL,ENCODED,MAGIC_ krsort($arrayname ,Sorting type);
‫ﺗﻌﻘﻳﻡ ﻣ ﺣﺗﻭﻯ‬ QUOTES,SPECIAL_CHARS) Filters true
Filter Type array_reverse($arrayName,preserve); save keys index
for checking FILTER_VALIDATE_FLOAT (INT,EMAIL,IP,MAC,URL) false
array( 'options'=>array(
shuffle($arrayName);
'min_range'=>1,
'max_range'=>999 array_fill(index , length ,value);
methods
),
'flags'=>FILTER_FLAG_IP4 array_sum($arrayName);
); options(qualifications)
array_rand($arrayName ,number); Random Values

array_unique($arrayName);
unix way time();
date_default_timezone_get('continent/country');
split the string into array
format the date=>('y-m-d h:i:s')
explode(separator , $stringName ,limit);
DATE explode
time stamp (time() +number) date(format,time stamp);
optional
http://php.net/manual/en/function.date.php limit
number(+ , - )
convert string(now,week,year,day,month) into time(y:m:d) strtotime(date , now);
convert explode to String

implode( separator ,$arrayName);


initialize file implode
separator is optional here
‫ﻣﻠﻑ ﺧﺎﺹ ﺑﺎﻋﺩﺍﺩﺍﺕ ﺍﻟﻠﻐﻪ‬
alis function is join(separator , $arrayName);
to make general modification
php.ini file string split(as character) str_split($stringName ,length);
xampp/php/php.ini
convert string into small chunks
information about php on server phpinfo(); String chunk
chunk_split( $stringName ,length(76) ,end(\n \r) );
str_replace(search ,replace , $objectName, number of
http://php.net replacing);
open php site and search about condition site:php.net condition google references replacing search =array("item1" ,"item2");
Outro
http://kat.cr may replace=array("item1" , "item2");
string repeat str_repeat($stringName ,Nrepeat );
string shuffle str_shuffle($stringName );
strlen( $stringName );
addSlashes(string); skip character
stripSlashes(string); clean without slashes
strip_Tags(string ,allow); hide all tags
strTolower(string);
strToupper(string);
lcfirst(string); lower case first
String ucfirst(string); upper case first
ucwords(string); upper case words
trim(string , "character list"); clean all tabs (remove)
ltrim(string); left trim
rtrim(string); right trim
str_word_count(string ,format ,charlist);
string word count
format 1 >for indexed arr ,2 >for associative array
parse string parse_str(string , array); convert all words in the string into variables
new line "\n" converted to break tag </br> nl2br(string);
string position strpos(string , key, offset);
string insensitive stripos(string , key);
string right position strrpos(string ,key);
strstr(string , key, before search);
@Ahmed A-Amer search for string within string stristr(string , key, before search);

alis strchr(string , key, before search);


> 0 greater than

strcmp(string1,string2); = 0 equals

string comparsion < 0 less than

strncmp(string1,string,number of chars);
reverse string strrev(string);
substr(string ,start, length);

substr_count(string ,needle ,length);


substracte String
> 0 greater than

substr_compare(string1,string2,start pos from str1,length,case); = 0 equals

< 0 less than

Вам также может понравиться