Function StripLastChar( $file ){
$fp = fopen("$file","r");
if ($fp){
$contents = fread($fp,100000);
fclose($fp);
}
$contents = eregi_replace("o$","",$contents);
return $contents;
}
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 30 May 2002 11:05
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
Sent: 28 May 2002 14:41
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
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, [EMAIL PROTECTED] 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php