Home >Backend Development >PHP Tutorial >Discuss the implementation method of reversing the order of PHP strings_PHP tutorial
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).