Today, when you encounter a requirement, you need to sort an array in a specified order and finally find a workaround:$sort _rule = [5,7,3,1,8,2]; $arr = [1,2,3,5,7,8]; Requirements, sort the array $arr in the order specified by the
One of the most important new features in PHP5.3 is the introduction of namespaces. Before that, PHP developers had become eager to implement namespaces in PHP. When PHP applications start to become huge and more complex, namespaces are necessary to
Instead of interpreting the array in PHP as an array in our narrow sense, I think we may also split this array into two parts. one is our regular array, and the other is our Dictionary.
1. arrays in PHP
Instead of interpreting the array in PHP as
I have already written a lot of deamon operations in the background. it works well, but I don't know how to implement it if I want to get the content from the MPs queue, like echoaaaa |. php,. php does not know how to obtain the echo content. hey,
PHP Cache data is very advantageous for faster and better function running. If a file is tested multiple times in the script, you may not cache the correct results. To achieve this, you can use the clearstatcache () function.
Definition and usage
The PHP type is case sensitive.
1. case sensitivity
PHP built-in functions and structures are case-insensitive.
For example:
The code is as follows:
HelloPHP
Echo ("Hello PHP ");
ECHO ("Hello PHP ");
Echo ("Hello PHP ");
?>
The
If the cout operator is followed by a constant integer, a maximum of 4294967295 can be output, that is, 2 ^ 32-1. negative numbers are not allowed. that is, the cout operator only loads the unsignedint type for the constant integer; if there is a
Sometimes you need to obtain the content of an https webpage. for the following method, refer. If you use file_get_contents directly, an error is returned;
The code is as follows:
$ Url = (https://xxx.com ");
File_get_contents ($ url );
PHP has $ _ GET, $ _ POST, but no $ _ PUT, so if you need to use it, you have to simulate $ _ GET in PHP, $ _ POST, but no $ _ PUT, so if you need to use it, you have to simulate it yourself:
The code is as follows:
$ _ PUT = array ();
If ('put' =
Creating image thumbnails takes a long time. This code helps you understand the thumbnails logic.
The code is as follows:
/**********************
* @ Filename-path to the image
* @ Tmpname-temporary path to thumbnail
* @ Xmax-max width
* @ Ymax-max
Array_flip () returns an inverted array. for example, the key name in trans is changed to a value, and the value in trans is changed to a key name. Description
Array array_flip (array trans)
Array_flip () returns an inverted array. for example,
Add, delete, query, and sort php arrays. For more information, see.
Detailed descriptions of data addition, deletion, query, and sorting
Add an array (add the first and last Data Records (not Limited) and add data anywhere in the middle ).
2 ~
No page operation for a long time, automatic expiration function
The code is as follows:
#*************************************** ****
# Function: No page operation, automatic expiration function
# Parameter: $ onlinetime the last time the
Sometimes we can see some pretty pictures on the network, but we don't want to save them manually, especially a large number of such images, at this time, we need to write a program to help us complete this job. Today, we found a previously found
In the previous article, I used cookies and discuz databases to retrieve user names, user groups, user IDs, and other information, but that information is not necessarily accurate, because the auth value in the COOKIE is used for dynamic login
Php gets flv time! Source code! You can use it! Super simple. You can easily obtain the time needed to play the flv video.
The code is as follows:
Function BigEndian2Int ($ byte_word, $ signed = false ){
$ Int_value = 0;
$ Byte_wordlen = strlen ($
Write a custom function to make $ dataarray (,) $ dataarray ); the number in the original array is split into "single" bits.
The following is a self-written function:
The code is as follows:
Function splitStrToArray_mine ($ array)
{
$ New_array =
Sometimes we have to perform a lot of log analysis to check the crawling situation of the spider, so we want to create a plug-in to record the situation of the spider. At the first time, I only recorded the number of spider crawlers, which is not a
As one of the most widely used languages in Web development, PHP has a large number of fans. Are you a good programmer? During self-cultivation, have you ever thought about how to break through the bottleneck of myself in order to develop better?
Simple chat room code written in php. For more information, see. Index. php
The code is as follows:
online chat
_ A. php
The code is as follows:
chat room
$ Person = @ $ _ POST [person];
$ Msg = @ $ _ POST
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