Sometimes we need in the PHP code, hide the IP address of the next two bits, and replace the phone number in the middle of the number as * number, to keep the relevant data, this article for you to introduce several methods of implementation,
1. Percent: replace% to%
$STR = ' Test the percent of this parameter, what will be replaced by ';
echo sprintf ($STR);
Return result: Test the% of this parameter, which will be replaced by what (percent is replaced by a%)
2. %b:
Working with dates in PHP is inconvenient, such as finding a month between two dates? What should we do?
File name: date.inc.php3
Before using these two functions, convert the date or datetime to the timestamp type.
Such as:
$today =mktime
PHP pear and DB are used
// +----------------------------------------------------------------------+
// | PHP version 4.0
|// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2001 the PHP
PHP Editing toolsDzsoftphpeditorPHP Designed for the web program editing software, with PHP editing, debugging, browsing, the original code view, file browsing, customizable source code samples and other functions, no need to set up a website host
First look at the manual introduction:
strtotime-to parse the datetime description of any English text into a Unix timestamp
Format: int strtotime (string $time [, int $now])
This function expects to accept a string containing the U.S. English date
Before trying to use the memcache, later found that memcached support Setmulti method, ready to turn to use the memcached library.
(tried, in fact, memcache from the support of multi-valued set, but not on the document, see Changelog seems to be 3.0
Listing 1: A simple dice roll
Many games and game systems require dice. Let's start with a simple section: Throw a six-sided dice. In fact, scrolling a six-sided dice selects a random number from 1 to 6. In PHP, this is very simple: echo rand (1,6);.
Header()is used to send raw HTTPHeaders. See the http/1.1 specification for more information on HTTPHeaders.
Example One:
Copy CodeThe code is as follows:
Header ("location:http://www.jb51.net";);
exit;//must add "exit" after each redirect to
Curl Installation:
installation under Windows: Modify the settings of the php.ini file to find the Php_curl.dll
Cancel the comment under the Extension=php_curl.dll
install under Linux:
Copy CodeThe code is as follows:
# wget
Assignment and replication of an object: assignment: Overloading with the "=" operator
User A (ten), B;
b = A;
Replication: Calling the copy constructor
User b;
User A (b);
Or
User A = b;//equivalent to User A (b);
In contrast to assignment, the
Although PHP was developed in C, I was puzzled that PHP did not provide direct support for struct structs.
However, PHP provides the pack and unpack functions for the reciprocal transfer of binary data and PHP internal data:
Copy CodeThe code is as
Whether you are writing JavaScript or PHP, you are always accustomed to using single quotes. But the weekend at home coding encounter a problem, you need to filter the string by PHP line breaks, follow the following method:
$out = str_replace (Array
The public platform provides a simple PHP sample code that we need to learn more about before further development.Official website: http://mp.weixin.qq.com/mpres/htmledition/res/wx_sample.zipThe complete code is as follows:
("TOKEN", "Weixin"=- =["
Personal public accounts and corporate public accounts
Remember that two months ago, I asked in the official development group what is the difference between the public account and the corporate public account, but also be laughed at, no one is
1, use the GD library function to generate the picture, and write the specified characters on the pictureImagecreatetruecolor Create a new true color imageImagecolorallocate Assigning color (palette) to an imageImagestring drawing
We are usingBecause it is easy to maintain and upgrade, we need to implement PHP installed as Apache DSO. For example, if you installed PHP to support only the database at initial installation, and then you want to install a module that supports
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