Is there any equivalent function that returns the character at position X
in PHP?
I went through the documentation but couldn't find any. I am looking for something like:
$charAtPosition20 = strCharAt(20, $myString);
Is there any equivalent function that returns the character at position X
in PHP?
I went through the documentation but couldn't find any. I am looking for something like:
$charAtPosition20 = strCharAt(20, $myString);
There are two ways you can achieve this:
a) use the index directly to access the character at the location, like, $string[$index] b) use the substr function: string substr ( string $string , int $start [, int $length ] ) http://us2.php.net/manual/en/function.substr.php