PHP format the numbers in RMB with commas (,) for each three digits
Function num_format ($ num ){
If (! Is_numeric ($ num )){
Return false;
}
$ Rvalue = '';
$ Num = explode ('.', $ num); // separate
PHP calculates the length of time between two timestamps.
/**
* Returns the time of the two time ranges, * minute * second, * YEAR * month * Day * hour * minute * second
* @ Param int $ one_time time 1
* @ Param
PHP converts Chinese characters to integer numbers, for example, one hundred and one to 101.
Test ();
/**
* Test
*/
Function test (){
Echo CnToInt ('1'); // 1
Echo CnToInt ('10'); // 10
Echo
PHP code for common MongoDB operations
$ Conn = new Mongo ();
// Can be abbreviated
// $ Conn = new Mongo (); # connect to the local host, default port.
// $ Conn = new Mongo ("172.21.15.69"); #
PHP processes Checkbox check box form submission
Add [] to the name of the PHP form submission page check box so that the correct result can be obtained on the receiving page. After the form is submitted, an array is obtained, and the
Php parses web pages and downloads images to a local device
// Error_reporting (0); // Close the error report
Include_once ("simple_html_dom.php"); // introduce the parsing library
$ Url = 'http: // www.
Convert the time to the format of a few days ago or hours.
Convert the time to several days ago and hours, for example, "1 day ago" or "2 months ago.
Function prettyDate ($ date ){
$ Time = strtotime ($ date );
$
Php uses cookies to record the number of visits
$ F_open = fopen ("count.txt", "r +"); // open the specified file
$ Count = fgets ($ f_open); // read data from the file
If (empty ($ _ COOKIE ['cookie _
PHP code output as an image
$ Query = "select count (ip) as count_ip from tb_count04 ";
// Query the total IP access volume in the database
$ Result = mysql_query ($ query );
$ Countes = mysql_result ($
Php code for reading and writing cookies
Setcookie ('mycooker', 'value ');// Function prototype: int setcookie (string name, string value, int expire, string path, string domain, int secure)Echo ($ mycookie );Echo ($ HTTP_COOKIE_VARS
PHP retrieves the first letter of a Chinese string
$ Limit = array (// gb2312 pinyin sorting
Array (45217,45252), //
Array (45253,45760), // B
Array (45761,46317), // C
Array (46318,46825), // D
Quick introduction to PHP webpage content capturing skills
How can we capture webpage content in php correctly? This problem is difficult for friends who have been familiar with PHP soon. The course subject introduced the specific solution
Php type conversion
You can use type conversion to convert the value of a variable to another type. This type conversion is the same as that in C language. You only need to insert the temporary data type to be converted in parentheses
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