Php returns a substring based on the specified position and length. it is a php string. Php obtains the sub-string based on the specified position and length. This document describes how to obtain the sub-string based on the specified position and length. For your reference, php obtains the sub-string based on the specified position and length.
This example describes how php obtains a substring based on the specified position and length. Share it with you for your reference. The specific analysis is as follows:
The substr function of php is very powerful, and the sub-string can be removed from the back and forth, and the string can be retrieved from the back and forth.
<? Php $ string = "beginning"; print ("Position counted from left :". substr ($ string, 0, 5 ). "\ n"); print ("Position counted form right :". substr ($ string,-7, 3 ). "\ n");?>
Output result:
Position counted from left: beginPosition counted form right: gin
I hope this article will help you with php programming.
Examples in this article describes how php obtains substrings based on the specified position and length. Share it with you for your reference...