Summary of various PHP sorting algorithms
// Bubble sort
Function BubbleSort ($ arr ){
// Obtain the total length of the array
$ Num = count ($ arr );
// Forward traversal array
For ($
Php Getting Started Tutorial (21) php date and time functions
Echo time (); /// return "1264668961"
?>
2, date ()The date () function is required to convert the UNIX timestamp to the readable current
Php method for obtaining array length (number of elements)
$ Users = array ("qdv.cn", "haotu.net", "sharejs.com", "google.com ");
Print count ($ users)-1;
Example 2: use php to obtain the array
Which programming language is most worth learning in 2015?
Craig Buckler, a freelance UK web consultant, has been engaged in programming language statistics for many years. This article provides statistics on the language rankings from four
An ordinary person
Who is it? What makes your heart feel bad. Who is it? What has warmed this cold night! There is no denying that people are always changing. even if you stick to the same year, you may not be aware of the previous steps
Php file download code (compatible with multiple browsers and supports Chinese file names)
/**
* PHP file download example
* By bbs.it-home.org
*/
Ob_start ();
$ Ua = $ _ SERVER
A small example of php database connection, query, and display results
/**
* Php database operations (connection, query, and display results)
* Edit: bbs.it-home.org
*/
Define ('hostname',
Php traverses folders and implements code editing and deletion.
/*
Function: (a) delete a file (B) edit a file, and delete a folder on a webpage (c), provided that the folder is empty (d) create a file or folder,
A classic example of PHP database read/write splitting
/**
* Mysql read/write splitting
* Edit: bbs.it-home.org
*/
Class db
{
Public function _ construct ($ SQL)
{
$ Chestr =
Php function for obtaining the folder size
// Get the folder size
Function getDirSize ($ dir)
{
$ Handle = opendir ($ dir );
While (false! ==( $ FolderOrFile = readdir ($ handle )))
{
If
Php uses memcache for multi-server sharing session
[Session]
; Handler used to store/retrieve data.
Session. save_handler = files; this is the session method. the default files can be used to store files.
PHP implementation code for obtaining MAC addresses
/**
* Obtain the physical (MAC) address of the machine Nic
* Currently, Windows/LINUX systems are supported.
* Edit: bbs.it-home.org
**/
Example of phpheader function usage (2)
Header ("Location: http://www.php.net ";);
Exit; // after each redirection, you must add "exit" to avoid errors and continue execution.
?>
Header
Php implementation code for exporting CSV files
// Note that the correct class path is included
Require_once (dirname (_ FILE _). '/export. php ');
$ Exceler = newJason_Excel_Export ();
//
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service