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 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 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
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
Php forced type conversion
Forced type conversion in php usually occurs in the environment where arithmetic operators are involved. arithmetic operators are common numeric operators. The operated content is generally called an operation
Obtains the last day of a month or the number of days of a month.
// Obtain the last day of a month or the number of days of a month
Function getMonthLastDay ($ month, $ year)
{
Switch ($ month)
{
Case 4:
Binary search PHP implementation
/** Binary search: searches for the position of a value in the array.
* @ $ Arr: array of operations, provided that they are arranged in order
* @ $ Val: the value to be searched.
PHP Singleton mode code
Class User {
Static function getInstance ()
{
If (self: $ instance = NULL) {// If instance is not created yet, will create it.
Self: $ instance = new User ();
}
Return self: $
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