Arrays in PHP are actually an ordered graph. A graph is a type that maps values to keys. This type has been optimized in many ways, so you can use it as a real array, or a list (vector), a hash (an implementation of a graph), a dictionary, set,
Over the past four years, I have been committed to developing PHP applications. PHP is indeed very easy to write. However, PHP also has some very serious defects.
Next I will give my own reasons why PHP is not suitable for websites larger than
If we want to get a large pile of data, we need to loop through the array. Now let's take a look at the PHP array loop to get the data. Because we are responsible for placing data in an array, how can we retrieve it now? Retrieving data from an
PHP foreach () has two usage methods:
The first usage of PHP foreach:
foreach(array_nameas$value)
{
statement;
}
Here, array_name is the name of the array to be traversed. In each loop, the value of the current element of
We are learningGenerally, all elements in an array are represented by characters or numbers. Therefore, you can sort the array elements in ascending order. This function is sort (). For example:
Php
$People=Array('Name', 'sex', 'nation'
In actualThe difference between the PHP function continue is that it accepts an optional numeric parameter to decide to skip several repeated loops to the end of the loop.
In php, continue is used in the loop structure to skip the remaining code in
We mentioned in the previous article how to use the ksort () function to sort by keywords. Today, we will focus on how to sort arrays by values. In this process, we will useThe specific code of Listing E is as follows:
php
We are learningThe specific code of Listing C is as follows:
php
$data = array("US" => "United States", "IN" => "India", "DE" => "Germany", "ES" => "Spain");ksort($data); print_r($data);
?>
The output result is as
We all know that,PHP function array_flip () format:
Array array_flip (array trans)// Array_flip -- exchange keys and values in the array
Array array_flip (array trans) // array_flip -- exchange keys and
InPHP print function 1 echo ()
Multiple strings can be output at the same time, and multiple parameters are allowed. Parentheses are not required and no return value is required.
PHP print function 2 print ()
Only one string and one parameter can
We all know that PHP has powerful functions, which brings me a lot of convenience. Let's take a look at the implementation of the PHP File Upload type. PHP supports file upload, but not all websites that support PHP support this function, especially
PHP brings me more convenient programming, but we will encounter problems when using it. here we will talk about the small problem of PHP uploading large files. Because it involves local and server security issues, page file Upload Based on input
When learning PHP, you may encounter PHP File Upload problems. Here we will introduce the detailed PHP file upload code to solve this problem. Here we will share it with you. The syntax of php is very simple. It is its simplicity that makes it the
With the development of the times, php is also being updated. Here we will introduce PHP5.0 installation, hoping to help those who love PHP. Suppose you have installed Linux and it runs correctly. Make sure that a C language compiler that can be run
PHP is a commonly used language for developing WEB dynamic pages. I have studied PHP Session usage and shared it with you here. I hope it will be useful to you. PHP Session refers to the time that a user spends browsing a website from entering the
1. Use HTTP header information
That is, use the php header function. The HEADER function in PHP is used to send control commands that should have been specified by the HTTP protocol to the browser through the WEB server, such as declaring the type
LearningThe program in the following example will display the string "you cannot find the value in the array" ("Not found in this array") on the page, because the string Albert you are looking for is indeed not in the $ namesArray array:
The
ThroughFile Path explanation: in Windows, you can use the/and symbol in the path, but in other operating systems, you can only use the/symbol. For the sake of consistency, we use the/symbol in a unified manner.
The following PHP file system-related
Strpos returns the position where string A first appears in string B (the return result is A number)
In contrast, the PHP string function is the final position of string A in string B returned by strrpos (the return result is A number)
Addcslashes
In PHP configuration functions, a function is used to set certain variable values in php. ini. It is the PHP ini_set function that we will introduce to you today.
The ini_set function is the value in the setting option. It takes effect after
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