Re: first letter
| From: | ApexEleven | Date: | Mon, 20 Dec 2004 19:16:44 +0000 |
| Subject: | Re: first letter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204754@lists.php.net to get a copy of this message | ||
[begin untested code]
$name = 'John';
echo substr($fname,0,1);
[end untested code]
That will print the first letter of the variable $name.
substr(string,int start, int length);
int length is optional.
On Mon, 20 Dec 2004 19:59:49 +0200, Ahmed Abdel-Aliem <me2resh@gmail.com> wrote:
> 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
>
>
--
<<--------------------------------------------------------
Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
------------------------------------------------------->>