RE: [PHP] Splitting a string

From: Date: Thu, 13 Mar 2003 14:36:51 +0000
Subject: RE: [PHP] Splitting a string
Groups: php.general 
Request: Send a blank email to php-general+get-139512@lists.php.net to get a copy of this message
This is perfect. I was not sure how to use the brackets with a variable for position. Thank you very much Christopher J. Crane Network Manager - Infrastructure Services IKON The Way Business Gets Communicated 755 Winding Brook Drive Glastonbury, CT 06078 Phone - (860) 659-6464 Fax - (860) 652-4379 -----Original Message----- From: - Edwin [mailto:copperwa11s@yahoo.co.jp] Sent: Thursday, March 13, 2003 9:30 AM To: Christopher J. Crane; php-general@lists.php.net Subject: Re: [PHP] Splitting a string Hi, "Christopher J. Crane" <ccrane@ikon.com> wrote: [snip] > If that number start with a "S", I want to strip it off. [/snip] Why don't you just check whether the first character is an "S" then return only the rest of the string if it is? Like: <?php $my_string = 'S12345'; if ($my_string{0} == 'S'){ $rest_of_the_string = substr($my_string, 1); } echo $rest_of_the_string; ?> Of course, there could be some other way... - E __________________________________________________ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/

« previous php.general (#139512) next »