Enhanced array_unique function (two-dimensional array supported)
// Remove duplicate values from two-dimensional arrays
Function array_unique_fb ($ array2D ){
Foreach ($ array2D as $ v ){
Function applications that convert variables to arrays in php
// Specify the variable
$ City = "Heze ";
$ Province = "Shandong province ";
$ Project = "PHP Program ";
$ Location_vars =
The project managers understand what programmers say.
Programmer: with the current design, I can get the basic framework in about a week. Then, we optimized and optimized the design from the beginning, and submitted a stable version in the
Three methods for converting strings to json format in js
Function strToJson (str ){
Var json = eval_r ('+ str + ')');
Return json;
}?>
Do not forget the parentheses on both sides of str. Method 2:
Example of using _ set and _ get in PHP
Class Person {
Function _ get ($ property ){
$ Method = "get {$ property }";
If (method_exists ($ this, $ method )){
Return $ this-> $ method ();
In-depth understanding of the requireinclude sequence in php
Ini_set ("include_path", ".: path_to_subdir"); // it indicates that there are two paths, one '.' indicates the current path, and path_to_subdir indicates
There cannot be any output before header and session_start in php
In php, the header and session_start cannot have any output because: in http transmission text, the order of header and content must be: header before content isIn php,
Example of using phpMailer to send mails in php
Require ("phpmailer/class. phpmailer. php ");
Function smtp_mail ($ sendto_email, $ subject, $ body, $ extra_hdrs, $ user_name ){
$ Mail = new PHPMailer ();
Php code for truncating text from a broken character
// Original PHP code by chiririnternet: www.chirp.com. au
// Please acknowledge use of this code by including this header.
Function myTruncate ($
Understand the implementation principles of php scheduled tasks
Ignore_user_abort (); // The PHP script can be executed even if the Client is disconnected (such as the browser is disabled.
Set_time_limit (0); //
A php function that batch modifies the file suffix
/**
* Modify the file suffix in batches
* Func: foreachDir
*/
Function foreachDir ($ path ){
$ Handle = opendir ($ path );
If ($ handle
The most comprehensive THinkPHP experience and skills in history are better than the manual
THinkPHP is the most comprehensive experience and skill in history. it is better to use THinkPHP than a manual. never miss THinkPHP.THinkPHP tips
Php code for creating readable random strings
/**************
* @ Length-length of random string (must be a multiple of 2)
**************/
Function readable_random_string ($ length = 6 ){
$ Conso =
Analysis on the applicability of global variables in php
$ A = 1;
Include 'B. Inc ';
?>
The variable $ a will take effect in the included file B. inc. However, in user-defined functions, a local
A recursive function written by php to generate a drop-down list for unlimited classification
/*------------------*/
//-Recursively implement the infinite classification to generate the drop-down list function
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