Getting a single character in a string

This snippet of code will show how to get individual character from a string in a variable

$sMyName = “Darwin”;

print $sMyName[1]; // will print the letter “a”

Leave a Reply