Re: First Character of a string.
| From: | Matt McClanahan | Date: | Sun, 08 Oct 2000 18:53:25 +0000 |
| Subject: | Re: First Character of a string. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19107@lists.php.net to get a copy of this message | ||
On Sun, 8 Oct 2000, Brian C. Doyle wrote:
> Hello All,
>
> How do I get just the first letter of a string.
>
> example
> <?
> $firstname ="Brian";
> $firstinitial="
> ?>
> here i want to parse out just the B from Brian with out hard coding it in
> <?
> ";
> echo $firstname,"<BR>";
> echo $firstinitial,"<BR>";
> ?>
Since a string is just an array of characters, you can use $firstname[0].
Matt