PDA

View Full Version : \b in PHP, available or not??



shachi
08-26-2006, 03:05 PM
Hello all,
I am currently using PHP to(practice) manipulating files and I was wondering if I could use the "\b"(don't know what it is called) escaping character to simulate a backspace character in a text file?? I have been trying this for ages now and it is driving me knots. Any help would be greatly appreciated!! Thanks in advanced!!

Twey
08-26-2006, 04:51 PM
Why would you want to?

shachi
08-26-2006, 05:00 PM
Because I am having trouble with an extra newline character in my file.:(

Twey
08-26-2006, 05:17 PM
Strip it then.
$lines = file('file.txt');
$lines[count($lines) - 1] = str_replace("\n", '', $lines[count($lines) - 1]);
$f = fopen('file.txt', 'w');
fwrite($f, implode('', $lines));
fclose($f);

shachi
08-26-2006, 05:29 PM
So, isn't there any \b thing in PHP??

Twey
08-26-2006, 05:35 PM
I don't think so, no. It doesn't really matter anyway, because it's a control character, it's not meant to be in text files. :)