RE: [PHP] How can I remove the last character from a one line file?

From: Date: Thu, 30 May 2002 10:11:28 +0000
Subject: RE: [PHP] How can I remove the last character from a one line file?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99868@lists.php.net to get a copy of this message
eregi_replace("o$", "", $String); Niklas -----Original Message----- From: Rea_David@emc.com [mailto:Rea_David@emc.com] Sent: 30. toukokuuta 2002 13:05 To: php-general@lists.php.net Subject: RE: [PHP] How can I remove the last character from a one line file? Hi all, The problem is nearly solved. I need my if statement to read the last character from the file & if it ends with an o, then remove the one character. My current if statement allows the action to take place if there is an o anywhere in the file. Can somebody help me with this. My current if statement looks like this: if (eregi (".*\b",$port)){ $port=substr($port,0,(strlen($port)-1)); } Thanks alot Dave -----Original Message----- From: Rea, David Sent: 28 May 2002 15:46 To: 'Ed Gorski' Subject: RE: [PHP] How can I remove the last character from a one line file? That worked a dream, Thanks Ed! Dave -----Original Message----- From: Ed Gorski [mailto:gorskie@spjc.edu] Sent: 28 May 2002 14:41 To: Rea_David@emc.com; php-general@lists.php.net Subject: Re: [PHP] How can I remove the last character from a one line file? Try: $string="Jacko"; $string=substr($string,0,(strlen($string)-1)); echo $string; ed At 09:35 AM 5/28/2002 -0400, Rea_David@emc.com wrote: >Hi all, > > How can I remove the last character from a one line file? > i.e. I need to change Jacko to Jack > > >I would really appreciate a response on this! > >Thank you! >Dave > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php #################################### Edmund Gorski Programmer / Analyst WWW Coordinator Dept. @ District Office 727-341-3181 #################################### -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#99868) next »