This article mainly introduces several practical functions of PHP, combined with examples to summarize and analyze the PHP network operation, string manipulation, time operation and the use of regular expressions and other skills, the need for
function definition: A function is a block of encapsulated code that can be called at any time. There are two kinds of functions in PHP: Custom functions and System functions.
Custom Function Syntax Format:
function name ([parameter 1,[parameter 2]
If you want to do security password and user name random I have a friend to do the login password of the server and username is to use the phpMyAdmin randomly generated password function to do, rather than use phpMyAdmin to do their own, Some of the
1.
buffer----Flush ()
Buffer is a memory address space, the Linux system default size is generally 4096 (1KB), that is, a memory page. It is primarily used to store data between devices that are out of sync or between devices with different
Type declaration
Look at the code, at a glance.
Class Person{public function age (Int. $age): string { return ' is '. $age; }}
namespace and Use Keyword batch Declaration
Non-mixed mode
Use publishers\packt\{book, Ebook, Video};use
The following is a detailed analysis of the method of invoking user-defined functions in PHP, the need for friends can come to the reference
Let's take the example first:The Call_user_func function is similar to a particular method of calling a
Grammar:
String substr (string $string, int $start [, int $length]), which can be used to find a matching string or character in a longer string, $string the string to be processed, $start the position to start the selection, $length is the length
/* Transaction script mode: Similar to the model layer in thinkphp, or the class that operates the database. Personally feel that the use of practice is quite simple and convenient, that is, the SQL statement written dead, flexibility is not enough.
Difference:
Require_once will only load the same file once, require will load multiple times.
I believe that the same as my small white or some doubts it. So we assume: if 456.php introduced 123.php, now file test_require.php introduced "456.php"
Thinkphp has a built-in abstraction database access layer that encapsulates different database operations, and we only need to operate with a common DB class, without having to write different code and underlying implementations for different
In our usual use of PHP to send mail, not every time need to use a powerful tool like Phpmailer, found on the internet a good PHP mail encapsulation function, the function can solve the following using the mail () function frequently encountered
This paper mainly introduces the usage of PHP template engine smarty built-in function Foreach,foreachelse, and analyzes the function of Foreach,foreachelse and the specific usage skill with instance form.
specific as follows:
In the Smarty
Beta version:
Old PHP 5.5.29, new version of PHP 7.0.0
Test method:
Class performancetest{Private $time; Private $memory; Public function begin () {$this->time = $this->gettime (); $this->memory = $this->getmemory (); Public
1. Use function start; 2. The function name can start with a letter or an underscore;3. The function body must be within curly braces ;
1
4.php function can have no parameters, can also have more than one parameter, if there are
First look at the print results and return values for the following methods:
public static void Main (string[] args) {System.out.println ("return value:" + TestResult ());} public static Boolean TestResult () {for (int i=1; i Start:" + i); if (i =
first, use return, output no content; But in two instances, return to echo, result 1000; Return is also used in three instances
, the result is 1000, the exact reason is: ECHO is the output value, return is the returned value but not output, if you
The development of the system has a large number of empty connections to the sleep state of the database, at the same time through the log Discovery system through the PHP Curl request the third-party API interface Feedback a large number of
The switch statement is used to perform different actions based on different conditions. This article introduces the usage examples of switch statements in PHP, it involves the knowledge points of switch usage, and the friends who are interested in
When Ecshop two times in the development of Product Classification index, the classification ID to obtain the top-level classification ID. The first response is recursive, so the recursive function is written as follows:
function Getcattopid ($cat _
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