For example, if you get the second $ str [1] or $ str {1}, {} is not recommended. It is best to use [].The test is as follows:Copy codeThe Code is as follows:// Obtain the last character$ Str = 'phpddt. com ';Echo $ str [strlen ($ str)-1]; // m//
[1] how to process variables using single quotes and double quotes:
Variables enclosed in double quotation marks are interpreted as values, but values enclosed in single quotation marks are not processed and directly output;
[2] to escape an
Sometimes the front-end page allows you to dynamically Add/delete multiple values of a certain attribute. For example, you can add or delete a book to the bookshelf dynamically.The form on the front-end page contains multiple input elements, as
Sometimes, when deleting information, you need to delete all the information under this information. This requires recursive deletion. The following is a piece of code that recursively deletes a department and all its sub-departments when I delete a
Php error handling
When we develop a program, sometimes the program has a problem, we can use the following methods to find out the error.
Development Phase: All error reports are output during development, which facilitates program
Conversion of Chinese characters to PinYin (full spelling and first letter)
-20319, 'ai'=>-20317, 'an'=>-20304, 'ang'=>-20295, 'ao'=>-20292, 'ba'=>-20283, 'bai'=>-20265, 'ban'=>-20257, 'bang'=>-
This article mainly introduces the paging example of the zf framework db class. The code is very simple. You can use it after reading the annotations.The following is a paging example code of the zf framework: '127. 0.0.1 ', 'username' => 'root',
This article mainly introduces examples of php string truncation functions that support Chinese and other encoding (intercepting Chinese strings). For more information, seeThe simple string truncation method supports Chinese characters and other
Copy codeThe Code is as follows:/* Simple use and operation of the filter ()*/
Require_once ("Zend/Loader. php ");// Convert the Filter string to lowercase or uppercaseZend_Loader: loadClass ("Zend_Filter_StringToLower ");Zend_Loader: loadClass
Most of the time, we need to convert a multi-dimensional array into a one-dimensional array, because we only need a one-dimensional array and it is more convenient to use it. in PHP, how can we convert a multi-dimensional array into a
Use foreach instead of while to traverse the array. When traversing an array, foreach is much more efficient than while loop, and you do not need to call the reset function. The two traversal methods are as follows:
1. replace I = I 1 with I = 1.
The PHPJSON application starts with PHP5.2. JSON support has been added since this version. There are two main functions: json_encode and json_decode.
Php json applications start with PHP5.2. JSON support has been added since this version. There are
According to this year's plan, there will be at least two articles per month, and there will be only one 2012 Summary for various reasons in August. for whatever reason, it is always wrong. This is a supplement, and it is also the beginning of this
The original object value of this variable was born in opcodeNEW. after being assigned a value (ASSIGN), the variable itself is passed to the caller of the execution environment during method initialization, when the caller executes the call
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