on 25/07/02 8:30 AM, [EMAIL PROTECTED]

> Anyway, with asides to the snooty "RTFM" reply I got, I thought I'd share.

No, I agree with the RTFM statement.  A simple search for "remove slashes"
on php.net would have resulted in links to all the slashes functions,
including stripslashes().

Then you could have tested it using this function, and posted a more
meaningful message like:

"I have a file in my disk hierarchy which seems to have \'s added to it,
possibly from a form post or something... any ideas how I strip them out?
I've tried doing it with stripslashes() using the following code, but it
isn't working."

Then we could have checked out your code, and offered more help.

In any way, this code should strip slashes out of a file:

$file = "mydir/myfile.txt";
  // get contents of a file into a string
  $fd = fopen ($file, "r");
  $txt = fread ($fd, filesize($file));
  fclose ($fd);
  $txt = stripslashes($txt);
  $txt = "File {$file} could not be found";

echo $txt;

Which, incidently, was adapted from a sample script in the file section
(fread I think) of the PHP manual :P

I know a few of us tend to just reply with RTM all the time, but in reality,
it helps you form better questions, and helps you understand your own
problem a little better.  More often than not, a decent sample script is
available for what you want, either in the manual, or in the user
contributed notes... but if you at least look at the manual first, you'll be
more likely to get good responses, because you post better questions like:

"I've tried to stripslashes using the following code, but it aint working...
any ideas?"

... which make it a lot easier to help you.

Justin French

Creative Director

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to