Click to See Complete Forum and Search --> : Backspace character? Or something like that?


Znupi
03-15-2008, 06:50 PM
I'm making a command-line program in php, and I have to delete some already outputted stuff. How do I do that? I tried echo "\b" and fseeking STDOUT but nothing. Is there any way to do it?

Znupi
03-15-2008, 07:12 PM
Found a way:
echo chr(8);
Is this the only way?

NogDog
03-15-2008, 08:02 PM
You could define a variable or constant to hold that value, then use it as needed instead of constantly calling the chr() function:

<?php
define("BS", chr(8));
echo BS.BS.BS.BS; // output 4 backspaces
?>

Znupi
03-16-2008, 05:57 AM
Indeed, that should ease things up a bit. Thanks :)