Re: first letter
| From: | hitek at cox dot net | Date: | Mon, 20 Dec 2004 19:10:30 +0000 |
| Subject: | Re: first letter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-204748@lists.php.net to get a copy of this message | ||
Not sure if it's deprecated or not, but you can reference it as an array:
echo $name[0];
or the more accepted method:
echo substr($name,0,1);
>
> From: Ahmed Abdel-Aliem <me2resh@gmail.com>
> Date: 2004/12/20 Mon PM 12:59:49 EST
> To: php-general@lists.php.net
> Subject: [PHP] first letter
>
> hi
> if i have for example this variable
>
> $name = "John";
>
> how can i echo the first letter only so the result on the browser will be "J"
>
> can anyone help ?
>
>
>
> --
> Ahmed Abdel-Aliem
> www.ApexScript.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>