RE: [PHP] first three characters
| From: | Jack Dempsey | Date: | Mon, 19 Mar 2001 06:13:59 +0000 |
| Subject: | RE: [PHP] first three characters | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44489@lists.php.net to get a copy of this message | ||
<?PHP
$Word = "attention";
$Word_3 = substr("$Word",0,3); //$Word_3 is 'att'
$Word_4 = substr("$Word",0,4); //Word_4 is 'atte'
?>
etc......you can use dynamic variables to extract the nth character from
your word..
jack
-----Original Message-----
From: Rahul Hari Bhide [mailto:rabhide@ptc.com]
Sent: Monday, March 19, 2001 1:02 AM
To: php-general@lists.php.net
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net