Note: Unless the array is referenced, foreach operates on a copy of the specified array, not the array itself. So the array pointers are not changed by the each () structure, and the changes to the returned array cells do not affect the original
Copy the Code code as follows:
/*—————————————————— */– Get list data for an unlimited assortment/*—————————————————— */function Get_sort ($parent _id=0, $n =-1){Global $db;static $sort _list = Array ();$sql = "SELECT * from". $db->table ('
Mysql_num_rows and COUNT (*) can count the total, that can be better?
Or
When do you use Num_rows and COUNT (*) separately?
An intuitive contrast
Test data:
Number of articles: 139,764
Data table Size: 500M
Results:
Fetch_num_rows spents: 35.27232909
The prototype of the Find function
Copy the Code code as follows:
/*** Returns the first record that meets the criteria and all associated data, and the query returns false with no results** @param mixed $conditions* @param string $sort* @param
The topic of the PHP interview question:
$a = '/a/b/c/d/e.php '; $b = '/a/b/12/34/c.php '; Calculate $b relative path relative to $a should be: /.. /c/d
Answers to the PHP interview questions:
Copy the Code code as follows:
function getrelative ($
Take a look at the following code:
Copy the Code code as follows:
Class A {Public function X () {echo "A::x () was called.\n";}Public function Y () {Self::x ();echo "A::y () was called.\n";}Public Function Z () {$this->x ();echo "A::z () was
Is the mind map for this series of functions--and I'm also the first to use a mind mapping tool. The big picture is here. The Stream_socket_* series is a new addition to the PHP 5 processing socket connection functions, simple and convenient, next
Copy the Code code as follows:
/*Compress multiple CSS files into one and the cache for an hour.Use the same code for Javascript, but replace below ' text/css ' with ' text/javascript ' and of course make sure you include . js files instead of.
Compiling and installing PHP 5.3.3
Since php5.3.x has brought php-fpm, there is no need to patch
# sudo./configure--prefix=/usr/local/php-5.3.3--with-mcrypt--with-gettext--with-mysql--with-gd--with-jpeg-dir--
Online Demo Address: http://tools.jb51.net/tools/cs.php
Copy the Code code as follows:
function Zhuanhuan () {$urlodd =explode ('///', $_get["url"],2),//The link is divided into 2 segments,//front is the first paragraph, followed by the second
Recently in a topic polling site, customers know something about the program. There are special requirements to filter some characters to prevent SQL injection. There was no particular study on this front. Oh, and carry forward a back take doctrine.
1. String comparisons
In PHP, you can compare strings with = = (double equals) or = = = (three equals). The difference between the two is that the double equals is not a comparison type, the three equals is the comparison type, it does not convert
1. Accessing a single character
In PHP, you can use a string as an array of characters, and you can access the string directly using the array's access method. such as $str[0].
It is important to note that access can be problematic if the characters
Install PHP Extensions: memcache steps under Windows
1. Download the PHP extension dll:http://downloads.php.net/pierre/
(If the above directory does not conform to your PHP compiled version of the DLL to go to Google, there will be a lot of Oh!)
Cause:
Today, the project encountered a problem: need to dynamically update the picture on the home page, to show that the site is not finished even if, is someone has been maintaining. Well, the demand has, how to achieve?!
My idea is as
Copy CodeThe code is as follows:
$arr =array ();$arr [' Good ']= ' bad ';$arr [' bad ']= ' not bad ';$arr [' Bad ']= ' good ';$arr [' Not bad ']= ' bad ';$str = "We are not good";Echo Strtr ($str, $arr);Output we are bad not bad?>
So the
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