$ Xml = simplexml_load_file ('example. xml'); // create a simplexml objectVar_dump ($ XML); // output XML?>
$ Xml = simplexml_load_file ('example. xml'); // read the XML fileForeach ($ XML-> depart as $ A) // read each depart tag in XML data
Several PHP algorithms involve the following examples.PHP bubblePHP binaryEvaluate the prime number in PHPPHP multiplication table
PHP Bubble Method example
Copy codeCode: // PHP bubble from small to large
Function maopao (& $ arr)
{
If (! Empty ($
This chapter describes several common internal functions of PHP arrays.
We have already introduced PHP arrays. Create an array using the array () function and delete an array element using the unset () function. In this section, we also need to
Case 1:
Father. php is defined as follows:
Copy codeThe Code is as follows: $ Jack = 1000;
?>
Children. php is defined as follows:
Require ("father. php ");
$ Jack = 123;
Echo $ jack. "/n ";
?>
Php children. phpThe output is 123.If you comment out $
PHP string functions include the character location search function, the sub-character extraction function, the replacement string, the character length, the comparison character function, the array character, and the space.
String functions in PHP
Here is a brief introduction to the cache technology: http://www.jb51.net/article/4965.htm
Php page cache mainly uses ob functions, such as ob_start (), ob_end_flush (), ob_get_contents ()
The following is the encoding section.
1. The initialization
Written by lostwolf
This is not a webshell, but a webshell kill-free tool.
Do not use webshell
Only kill-free phpwebshell
This tool runs in cli mode!
If there is any file content that cannot be broken through, you can try to use this tool to stop
In the database, there is a "Tag" field in the table storing the article to store the Tag. Tags are separated by commas. For example, "PHP, VB, essay ".
The following implementation code searches for tags from the database and formats them so that
A project was created last year to list the text list of the image files uploaded by the user. After clicking a file name, the user can display the image.
Considering compatibility with various image formats, I used the GD library to determine
Comparison of three methods for generating XML files in PHP
There are three methods: Direct Writing; using DomDocument; using SimpleXML;
There are actually 4th types: XMLWriter, but I have never used it and I am too lazy to try it.
I want to see
Copy codeThe Code is as follows: // ---- Display the code START in the previous and next articles ----
$ SQL _former = "select * from article where id $ SQL _later = "select * from article where id> $ id"; // The SQL statement in the next article$
Let's take a look at the explanation in the official php documentation:
_ Set () is run when writing data to inaccessible properties.
_ Get () is utilized for reading data from inaccessible properties.
How can I translate data in
If the values are not repeated, you can use array_flip () to exchange keys and values, then krsort (), and then array_flip () to compare the values. Array_slice () is available to intercept arrays ().
If there are duplicate values, some sorting
Php built-in functions exec and system can call system commands (shell commands). Of course, there are also passthru, escapeshellcmd and other functions.
In many cases, using the exec, system, and other functions of php to call system commands can
In fact, we can use the array_filter function to easily remove multi-dimensional null values without changing the subscript of the array. The following is an example:
$ Array = array (
0 => 'your go ',
1 => false,
2 => 1,
3 => null,
4 => '',
5
Copy codeThe Code is as follows: // This method is purely a back-function and is not explained;
Function countStr ($ str ){
$ Str_array = str_split ($ str );
$ Str_array = array_count_values ($ str_array );
Arsort ($ str_array );
Return $ str_array;
The php code is as follows:
Copy codeThe Code is as follows: Header ("Content-type: text/html; charset = UTF-8 ");
If (! Empty ($ _ POST ['submit ']) {
$ Url = $ _ POST ['url'];
// Operations to obtain images with relative paths
$ Url_fields = parse_
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