Working with files in PHP is a basic requirement for PHP programmers, and PHP provides a number of tools for creating, uploading, and editing files.This tutorial begins by explaining how to interact with a file. To help you understand all the types
foreach ($array as $value) {//$array the array to traverse, $value pointer to the current value of the array, as the function of the assignment
code to executed;
}
Copy CodeThe foreach statement can also get the key name of
PHP code
Chr (0) is not NULL
Null is nothing, and Chr (0) has a value of 0. 16 binary is 0x00, which means binary is 00000000
Although Chr (0) will not show anything, but he is a character.
When the Chinese character is truncated, according to the
Class Employee {
Defining constants
Const AVAILABLE = 0;
Const OUT_OF_STOCK = 1;
Public $status;
}
Print employee::available;
?>
Copy CodeExample 2, defining constants in a class
Ini_set ("Display_errors", 1);//Whether an error message is displayed
Ini_set (' include_path ', Ini_get (' include_path '). ';D: \ \php\\phpexcel 1.6.6\\tests\\classes\\ ');//Set this page to include a path
Include "classes/phpexcel.php";
Share a few PHP code to get the current CPU usage in the system, a friend of the need to make a reference to it.In PHP, you can use Getrusage () to get CPU usage, which applies only to Linux systems. Example:
0 [Ru_inblock] + 0 [ru_msgsnd] = 2
This article describes how to format the contents of a string as an array, and how to convert the method to actual arrays, as required by a friend reference.There is a string that stores the contents of an array, for example:$STR = "Array (' USD ' =
Sharing the next PHP call user-defined functions, there are simple and complex, suitable for beginners to the PHP custom Function Reference.The Call_user_func function, the Call_user_func_array function, and the CALL_USER_FUNC function are often
function safeencoding ($string, $outEncoding = ' UTF-8 ')
{
$encoding = "UTF-8";
for ($i =0; $i
{
if (Ord ($string {$i})
Continue
if ((Ord ($string {$i}) &224) ==224)
{
The first byte is judged
This article shares the following PHP use mysqli extension operation MySQL database of several examples, very good, have the need of friends can refer to, will certainly help.1, MYSQLI Expansion Library operation of MySQL DQL
Connect_error)
This article introduces a few examples of the Eval function in PHP, with the need for a friend to refer to it.In PHP, the eval function is used to substitute values into strings.Syntax: void eval (string code_str); Return value: No function type:
This article describes two examples of PHP global variables $_server, namely, record access information, $_server[' Request_ The use of METHOD '. Please refer to the friends who are in need. Example 1, record the visitor information to obtain the
PHP gets today's start timestamp and end timestamp
$beginToday =mktime (0,0,0,date (' m '), date (' d '), date (' Y '));
$endToday =mktime (0,0,0,date (' m '), date (' d ') +1,date (' Y '))-1;
PHP gets yesterday start timestamp
If you have http_x_wap_profile, it must be a mobile device.
if (Isset ($_server[' http_x_wap_profile ')) {
return true;
}
Copy CodeAnalysis: By getting the Http_x_wap_profile information returned by the client, it can
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