Hi,
How to you strip all characters from a string, other than the first one?
i.e. if the string was "Stuart" how do you get to "S"?
Cheers,
StuG
try using substr and strlen:
$firstchar = substr($str,1,strlen($str));
I haven't tested it. But there is tons of docs and examples on PHP.net under the substr function.
good luck andre @ performance technologies
yup,
he's right.
Cheers
On the other hand, PHP let's you cheat and point to character in strings asif the string was an array:
$sString = 'hello'; $sFirstchar = $sString[0]; echo $sFirstchar;