try using the function substr()

$Word = attention

$Word_3 = substr ($Word, 0,3)
$Word_3 = substr ($Word, 0,4)

and so on

hope that helps
regards

Ankur Verma
HCL technologies
Noida
India

-----Original Message-----
From: Rahul Hari Bhide [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 11:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] first three characters


Gurus,
    How do I extract the first n characters out of a word . I have this-

$Word = attention

I want -

$Word_3 = att
$Word_4 = atte
$Word_5 = atten
this is only extracting first three/four/five characters .

What is the right function to use here ??

thx in advance.
~Rahul





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to