Home >Backend Development >PHP Tutorial >Discuss the implementation method of reversing the order of PHP strings_PHP tutorial

Discuss the implementation method of reversing the order of PHP strings_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:31:221152browse

How do we reverse the order of PHP strings in The last method involves three knowledge points:

1. ceil() function: rounding to the nearest integer . For example: 5/4=1.25, ceil(5/4)=2, regardless of whether the decimal place is greater than 0.5, it is rounded up.

2. The string is accessed as an array, such as $str[0], $str[1]…The first character and the second character of the string $str can be accessed…

3. Dichotomy. Method 3 of reversing the order of PHP strings requires the number of loops to be the length of the string, while method 4 is half the length of the string, so the efficiency will be doubled (theoretically).


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446238.htmlTechArticleHow we use the last method of reversing the order of PHP strings involves three knowledge points: 1. ceil( ) function: rounding to the nearest integer. For example: 5/4=1.25, ceil(5/4)=2, regardless of whether the decimal place is greater than...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn