I want to get the letter of a certain 'index' within a string. I know there is the strpos function but this is pretty much the opposite I want to do.
For instance:
$String = 'Hello';
echo getIndexOf(4, $String);
It would return 'o';
Is there any way I can do this? Thanks in advance!
You could simply do
$String[4]
or use the substr function :
substr($String, 4, 1).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.