PHP is currently the most widely used web-based programming language, driving millions of web sites, including some large sites such as Facebook. This collection of 21 practical and convenient snippets of PHP code is helpful for each type of PHP
This article is an example of the code snippet commonly used in PHP. Share to everyone for your reference, specific as follows:
1. Calculate the difference of two times a few days
$startdate =strtotime ("2009-12-09");
$enddate =strtotime ("2
In fact, someone on the internet has already analyzed this, and written a tool, but I tested a lot of, no one can use, so I decided to analyze from the beginning.
Open the shield after the encryption of the source code, you can see that
It is
* Ini_get (): Gets the option value of the configuration file
This function is believed by many people to get the value of one of the options in the configuration file, return 1 if the value is true, and return 0 if the value is false, and the
Before an instance is explained, introduce several core functions: the mktime function mktime () function returns a Unix timestamp for a date. The argument always represents the GMT date, so IS_DST has no effect on the result. The parameter
PHP is very efficient in development, this is understandable, but it is at the expense of implementation efficiency. PHP Array function is very powerful, but also need to consider more, try several situations, just in case, here, I simply said that
In the current PHP version of the default configuration, "Output buffer (buffering)" is opened. This is not the case in older versions of PHP, where strings are emitted every time it is output (via the Echo or print function), triggering an action
Today wrote an AES encryption class for PHP. Applies to the extension of Yii. If you do not need to replace the Yii::app ()->params[' Encryptkey '] in the YII framework with your corresponding default key. Class Code:
params[' Encryptkey ']:
Fatal error is generally not required to capture, but in a complex program, if the occasional lack of memory causes Fatal error is difficult to deal with.
Like what. Fatal error out in the MySQL class when the fetch. It's difficult to pinpoint the
In this article we will provide you with two kinds of methods about traversing object properties, and illustrate the application of traversal object properties in PHP. You can see that the private variable and the static variable are not available,
In the Web development will often encounter some simple video playback function, but now the video format is different, and can be dynamically increased, so we have to save the video to the data Oh, okay, let's look at the paragraph I wrote a simple
Definitions and UsageThe trim () function deletes white space characters and other predefined characters from both ends of the string.GrammarTrim (string,charlist) parameter descriptionString required. Specify the string to check.Charlist Optional.
This article to introduce a jquery+ajax+php implementation of "like" rating function code, the user clicks on the page of their favorite picture on the red button, the front-end page to the background to send an AJAX request, the background of the
PHP implementation of the number format, the number of three-bit comma function function, the specific code is as follows:
function Num_format ($num) {
if (!is_numeric ($num)) {return
false;
}
$num = Explode ('. ', $num);/to
Here is your own hands-on code, and we learn to study together.
Product comparison of the call JS file (contains the merchandise contrast box floating js):
/* Floating window * * (function () {var n=10;
var Obj=document.getelementbyid
This article mainly describes the PHP file upload with the relevant configuration of knowledge points. PHP File Upload function Configuration mainly involves the php.ini configuration file upload_tmp_dir,upload_max_filesize,post_max_size and other
Verification code in the form to achieve more and more, but with JS write the verification code, always feel inconvenient, so learn the next PHP implementation of the verification code.
Well, there is nothing to do, but do not want to waste time,
This article is intended to record the small problem solution in the development process of YII, not comprehensive, not authoritative, not a tutorial. I have written, think can solve the problem, later may also use, remember it.
1. The introduction
Here is a detailed explanation:///\\\
String UrlEncode (String str)
Returns a string, in addition to the-_ in this string. All non-alphanumeric characters are replaced with a percent sign (%) followed by a two-bit hexadecimal number, and the space
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