Web service

PHP code that is used a lot hamsujung

The code that is commonly used in php function….


Function name
 Function Description
 
echo
 And it outputs a string.
 
print
 And it outputs a string.
 
htmlspecialchars
 And without changing a line output the HTML code as a string.
 
nl2br
 Before the newline <BR/>Automatic change to the line by inserting a tag.
 
substr
 Extract the string back and forth depending on the part number specified haejun.
 
strstr
 The string you want to find and return the first string after the position represented by.(The case-sensitive.)
 
strchr
 Find a string and returns a string that appears in the last position after the start of.
 
trim
 Remove the space character in the front and rear of the string.
 
addslashes
 Single and double quotation marks, It puts a backslash in front of characters such as the backslash.
 
stripslashes
 addslashes() Turn the backslash character is processed as a function to the original state..
 
explode
 And dividing by the specified separator string into an array.
 
strcmp
 It compares two strings.
 
date
 The output formats to fit the specified time and date.
 
time
 Current unix time to time(second)To get.
 
mktime
 It gets a specific date and time in unix time.


If there is no factor to obtain the same result as the time function.
 
checkdate
 Checks if a given date and time really exist.
 
microtime
 To obtain a Unix time and time of microseconds.
 
getdate
 It obtains the date and time information in the form of an array.
 
file
 To read the file and returns an array.
 
filesize
 Return the size of the file in bytes.
 
file_exists
 Check if the file exists.
 
fopen
 Open the specified file mode.
 
fclose
 fopen() Close the file opened by the function.
 
is_dir
 Directory cognitive tests.
 
is_file
 File or checks.
 
copy
 Copy the files.
 
unlink
 Deleting files.
 
mkdir
 Create a directory.
 
rmdir
 Delete the directory.
 
array
 To produce an array.(construction)
 
list
 It takes the values ​​in the array assigned to the specified variable also(construction)
 


 


 


 



Date and time functions


 


checkdate : Check that you have the correct date and time given.


date : It returns the time and date in the format specified by the array.


getdate : It is obtained as an array in the form information of the date and time.


gettimeofday : Get the current time data in the system.


gmmktime : UNIX time of the dates specified in Greenwich Mean Time(timestamp)Gets.


localtime : Get the current local time server.


mktime : Unix time to a specified date(timestamp)It is obtained by.(city,minute,second,month,Work,year)


microtime : To obtain a Unix time and micro-time value of the current time.


strftime : And it outputs the time and date information in the given format.


time : Current unix time to time,(timestamp)To get.


 


String Functions


 



AddCSlashes C adds a format string with slashes


addslashes puts a backslash character in front of certain characters, such as single quotes, double quotes.


Bin2hex change the binary data into hexadecimal representation.


Remove the space character at the end of the chop string and returns a string.


chr Return a specific character .chr()Function returns the character corresponding to the ASCII function .ord()The function returns the ASCII value of the first character in the string.


It chunk_split divide the string into smaller pieces.


Return information about characters used in a string count_chars.


Create a 32-bit cyclic redundancy checksum value of crc32 str. Usually used to confirm that all data is transferred.


crypt One-way string encryption(Hashing). 


echo Output one or more strings.


Remove explode a string by string


Fprintf formats the string to a stream.


Convert the hebrev logical Hebrew text to visual text to indicate the maximum number of characters to be printed on one line.


hebrevc newline(\n)The “<br>n”Except for the points bakkunneun, the Hebron()The same as.


html_entity_decode Convert all HTML entities to their applicable characters.


htmlentities Convert all applicable characters to HTML entities.


htmlspecialchars Convert special characters to HTML entities.


‘&'(Ampersand)It is'&'It will be.


‘”‘(Quotes)When you do not specify a ENT_NOQUOTES '”'It will be.


”'(Single quotes)It is only when you specify the ENT_QUOTES ”'It will be.


‘<‘(Less than)It is'<'It will be.


‘>'(Greater than)It is'>'It will be.


 


implode as all the array elements in order, It returns a string representation of appending the glue string between each element.


Obtain localeconv numeric formatting information.


Remove the space ltrim beginning of the string.


md5_file Calculate the md5 hash of a given filename.


Md5 Calculate the md5 hash of a string hash is a 32-character hexadecimal.


Inserts HTML line breaks before all newlines in a string nl2br.


Format divided into a number number_format thousand.


The ord Return ASCII value of character.


Output the print string.


Printf prints the format string.


quotemeta quote meta characters backslash character before(\)The return appending str.


Remove the space rtrim string end.


similar_text Calculate the similarity between two strings.


It returns a formatted string sprintf.


str_ireplace insensitive str_replace().  


The length of any strings that populate the str_pad with another string.


Repeat str_repeat string.


str_replace Replace all occurrences of the search string with the replacement string.


Shuffle randomly str_shuffle string.


It converts a string into an array str_split.


In strip_tags string Strip HTML and PHP tags.


stripcslashes addcslashes()Return the string processing.


stripos case insensitive to locate the position of first occurrence of a string


stripslashes addslashes()Return the string processing.


Strlen Returns the length of string.


strpos Find position of first occurrence of a string.


Find the last occurrence of a character in a string strrchr.


Turn the strrev string.


Find the last location string is displayed in strripos case-insensitive string.


Browse to the location of the last character in the string strrpos


strstr string finds the first occurrence of partial


Create a strtolower string to lowercase.


Strtoupper create a string to uppercase.


strtr Translate certain characters.


substr_count Count the number of substring


And replacing a part of substr_replace string.


Return part of a string substr.


Remove spaces at the beginning and end of a string trim.


Ucfirst makes the first letter of a string to uppercase.


Change the first character of each word in a string to uppercase ucwords.


Stop using wordwrap text wraps a string to a given number of.


 


File Functions


 


basename : It returns only the filename in the pathname.


chgrp : Convert a group of files.


chmod : Change the mode of the file.


chown : Change the owner of the file.


clearstartcache : Delete the files in the cache statistics.


copy : Copy the file, and returns true if performed correctly.


dirname : The only component of the path name of the directory returned by the.


fopen : Read the file path or url of the file or open it in write mode.


fclose : fopen() Open and close the file pointer to a function.


feof : Current tests that the position of the pointer at the end of the file.


fflush : And it sends the output to a file.


fgetc : It reads a character from file pointer.


fgets : Reads a file line by line.


file : File reads the entire array(Line by line)Return to.


fileatime : It returns the last time access to files.


filesize : Return the size of the file in bytes.


file_exists : Check whether the specified file exists.


fpassthru : The output all remaining data on a file pointer.


fputs : Record the number of bytes in the file specified.


fread : It reads the file specified number.


fwirte : Record File. is_dir : Return to check whether the name of the directory you specified.


is_executable : Return to check whether the name you specify whether to run possible.


is_file : Return to check whether the generic file name specified.


is_link : Return to check whether the name is a symbolic link specified.


is_readable : Return to test whether the specified file is read.


is_writeable : It returns whether the specified file is to write checks.


mkdir : The saengsang directory.


move_uploaded_file : Move the uploaded file to a new location.


readfile : It reads the output file.


rename : Change the file name.


rmdir : Remove directory


unlink : Deleting files.


 


 


Directory Functions


 



chdir : Change to the directory.


chroot : Change the root directory.


closedir : Close directory handle.


to you : Directory class that you can use the related functions


opendir : It opens a handle to the specified directory


readdir : Read the names of directories and files in the directory.


rewinddir : It returns a directory handle to the very first.


Schandir : It returns a list of files and directories in the specified path.


 


 


 


URL Functions


 



base64_decode : Decodes the base64 encoded data to the original state.


base64_encode : And encode the data to the base64.


get_meta_tags : Return the meta tag content into an array.


http_build_query : It creates a query string of code.


parse_url : By storing the information in the url array and return its components.


rawurldecode : It decodes the encoded string url.


rawurlencode : The url for the code according to RFC 1738.


urldecode : It decodes the encoded string url.


urlencode : The code string url.



 


 


Variable functions


 



doubleval : Obtain the real number value of the variable.


empty : And it checks that the variable value is present.


get_definde_vars : It returns an array of defined parameters.


gettype : It returns the type of a variable.


import_request_variables : It brings to the global GET / POST / Cookie variables.


intval : It returns the integer value of a variable.


is_array : Check whether a variable is an array type.


is_double : Check whether a variable is a real type.


is_int : Check whether a variable is an integer.


is_null : Check if the variable is null..


is_numeric :  Check whether a variable is numeric or numeric.


is_object : Check whether a variable is an object.


is_string : Check whether a variable is a string.


isset : Verify that the variable exists.


print_r : And easily print variable information on the person reading.


settype : Set the type of a variable.


strval : And it converts the variable to a character value.


unserialize : It converts the PHP value.


unset : Delete the variable.


 



 


 


Mathematical Functions


 



abs : It returns the absolute value.


cos :  Arc cosine


base_convert : It converts the number into a random binary number.


bindec : 2It converts the binary number to a decimal number.


ceil : Calculate a value rounded up to the decimal point.


decbin : 10It converts the decimal to binary.


dechex : 10It converts the number to hexadecimal.


decoction : 10It converts the binary to octal.


floor : Calculate a value rounded down below the decimal point.


fmod : Return the remaining point in the division.


getrandmax : It returns the largest value of the random value.


hexdec : 16It converts the binary number to a decimal number.


is_finite : Determines whether the number of allowed range.


is_nan : The value is the number of tests is not.


log : Natural logarithm


max : It returns the maximum value.


me : It returns the minimum value.


mt_rand : It generates a random number.


pow : And again it returns the value of the square.


rand : It generates a random integer.


round : Calculate a value rounded off to a variable.


without : Arcsine


tan : Arctangent


 


#########################################################


Date and time functions


Function Name Function Description Details
A factor checkdate check whether a given date is valid. More information
date prints the date and time according to the specified format.
a : Morning and afternoon, Lowercase am, pm
A : Morning and afternoon, Uppercase AM, PM
B : Swat Internet time value from 000 999
c : ISO 8601 date (In PHP 5) 2004-02-12T15:19:21+00:00
d : Work, 2 digits with leading zeros from the front 01 31
D : Day of the week, 3Letters from letters Mon Sun
F : month, January, December January from a complete representation of the characters, such as March
g : city, 0From this one does not adhere to the 12-hour format 12
G : city, 0Since the 24-hour format 0 does not stick 23
h : city, 0The catch from the 12-hour format 01 12
H : city, 0The catch from the 24-hour format 00 23
i : minute, 0Since the stick type 00 59
I : (Uppercase i) If daylight saving time if daylight saving time 1, if not 0
j : Work, 0From this one does not stick format 31
l : (Lower case 'L') Day of the week, Since the complete text representation Sunday Saturday
L : And whether a leap year is a leap year 1, if not 0
m : month, Number representation, 0Since the stick type 01 12
M : month, Short text representation, 3Letters Jan Dec
n : month, Number representation, 0From this one does not stick format 12
O : Greenwich Mean Time(GMT)Difference from the example: +0200
r : RFC 2822 For Type Date: collection, 21 Dec 2000 16:01:07 +0200
s : second, 0The attached form 00 from 59
S : English ordinal suffix for the day expressed, 2St letters, nd, rd, or th. It works well with j.
t : From 28 days of the given month 31
T : The time zone setting of this machine Examples: EAST, MDT …
The : Unix Epoch(January 1 1970 00:00:00 GMT)Second time from the() Reference
w : Day of the week, Numeric 0(Sunday)from 6(Saturday)
W : ISO-8601 year Parking, Which starts on Monday (Added in PHP 4.1.0) Yes: 42 (42nd week of the year)
Y : year, 4 Digit represented example: 1999, 2003
Y : year, 2 Digit represented example: 99, 03
from : The primary of the year (0Start from) 0from 365
FROM : The offset of the second zone. Offset from UTC is always negative and the West, Offset the east of UTC is always positive. -43200from 43200


 More information
Open the information received to date getdate timestamp type,month,Work,city,minute,Return to the information of the second, etc..
seconds : Numeric representation of seconds 0 from 59
minutes : Numeric representation of minutes 0 from 59
hours : Numeric representation of hours 0 from 23
mday : Numeric representation of the day 1 from 31
wday : Numeric representation of the day 0 (Sunday) from 6 (Saturday)
mon : Numeric representation of the month 1 from 12
year : Numeric representation of the Year, 4 Examples digit: 1999 or 2003
yday : The primary of the year 0 from 366
weekday : Day of the week, From Sunday Saturday full text
month : month, Full text, 나 March January December January 부터
0 : Unix Epoch (January 1 1970 00:00:00 GMT)Second from, time()Similar to the values ​​returned by the, date()To be used by. A system-dependent, Generally -2147483648 from 2147483647.
 More information
gettimeofday Get current time. More information
gmmktime GMT(Greenwich Mean Time) Get a Unix timestamp of the date specified by the time. More information
It displays the current local time localtime server details
The microtime return a Unix timestamp value and the micro-time corresponding to the current time. More information
mktime timestamp for a specified date(Unix time in seconds)It is converted to a value.
Yes)mktime(city,minute,second,month,Work,year)  More information
You can specify the language to output date information in a specific format strftime. More information
time obtains the current time with a timestamp value. More information


 
String Functions
Function Description Details
AddCSlashes C adds a format string with slashes. More information
addslashes puts a backslash character in front of certain characters, such as single quotes, double quotes. More information
Bin2hex change the binary data into hexadecimal representation. More information
Remove the space character at the end of the chop string and returns a string. More information
chr Return a specific character .chr()Function returns the character corresponding to the ASCII function .ord()The function returns the ASCII value of the first character in the string. More information
Chunk_split divide the string into smaller chunks. More information
Return information about characters used in a string count_chars. More information
Create a 32-bit cyclic redundancy checksum value of crc32 str. Usually used to confirm that all data is transferred. More information
crypt One-way string encryption(Hashing). More information
echo Output one or more strings. More information
To explode a string separated by string. More information
Fprintf formats the string to a stream. More information
Convert the hebrev logical Hebrew text to visual text to indicate the maximum number of characters to be printed on one line. More information
hebrevc newline(\n)The “<br>n”Except for the points bakkunneun, the Hebron()And the same. More information
html_entity_decode Convert all HTML entities to their applicable characters. More information
htmlentities Convert all applicable characters to HTML entities. More information
htmlspecialchars Convert special characters to HTML entities.
‘&'(Ampersand)It is'&'It will be.
‘”‘(Quotes)When you do not specify a ENT_NOQUOTES '”'It will be.
”'(Single quotes)It is only when you specify the ENT_QUOTES ”'It will be.
‘<‘(Less than)It is'<'It will be.
‘>'(Greater than)It is'>'It will be.
 More information
implode as all the array elements in order, It returns a string representation of appending the glue string between each element. More information
Obtain localeconv numeric formatting information. More information
Remove the space ltrim beginning of the string. More information
md5_file Calculate the md5 hash of a given filename. More information
Md5 Calculate the md5 hash of a string hash is a 32-character hexadecimal. More information
Inserts HTML line breaks before all newlines in a string nl2br. More information
Format, separated by thousands the number number_format. More information
ord Return ASCII value of character. More information
Output the print string. More information
Printf prints the format string. More information
quotemeta quote meta characters backslash character before(\)Appending the return str. More information
Remove the space rtrim string end. More information
similar_text Calculate the similarity between two strings. More information
It returns a formatted string sprintf. More information
str_ireplace insensitive str_replace().  More information
Str_pad fills the string with another string of any length to be. More information
Repeat str_repeat string. More information
str_replace Replace all occurrences of the search string with the replacement string. More information
I randomly shuffled the string str_shuffle. More information
It converts a string into an array str_split. More information
In strip_tags string Strip HTML and PHP tags. More information
stripcslashes addcslashes()It returns a string treated as. More information
stripos case insensitive to locate the position of first occurrence of a string More information
stripslashes addslashes()It returns a string treated as. More information
Strlen Returns the length of string. More information
strpos Find position of first occurrence of a string. More information
Find the last occurrence of a character in a string strrchr. More information


Turn the strrev string. More information
Locate the final position without appearing insensitive string in a string strripos. More information
Browse to the location of the last character in the string strrpos Details
strstr string finds the first occurrence of partial Details
Create a strtolower string to lowercase. More information
Strtoupper create a string uppercase. More information
strtr Translate certain characters. More information
Details count the number of substring substr_count
And replacing a part of a string substr_replace. More information
Return part of a string substr. More information
Remove spaces at the beginning and end of a string trim. More information
Ucfirst makes the first letter of a string to uppercase. More information
Change the first character of each word in a string to uppercase ucwords. More information
Stop using wordwrap text wraps a string to a given number of. More information


 

Show More

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button
Close
Close