Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-04-2002, 04:45 AM   PM User | #1
Narz
New Coder

 
Join Date: Jul 2002
Location: Queens, NY, USA
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Narz is an unknown quantity at this point
Question Command to clear screen in PHP?

Is there a Clear Screen command in PHP? Thanks!
__________________
"Is life not a hundred times too short
for us to stifle ourselves?"
Narz is offline   Reply With Quote
Old 12-04-2002, 10:04 AM   PM User | #2
Ökii
Regular Coder

 
Join Date: Jun 2002
Location: UK
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Ökii is an unknown quantity at this point
Clear what screen? The browser page?
__________________
Ökii - formerly pootergeist
teckis - take your time and it'll save you time.
Ökii is offline   Reply With Quote
Old 12-04-2002, 01:03 PM   PM User | #3
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
T.V. Screen? lol
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 12-04-2002, 02:10 PM   PM User | #4
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
I think they're asking for the command to clear the screen when your using php from the command line. Like clr in DOS or clear in Linux. Is it possible wiht PHP from the command line?
bcarl314 is offline   Reply With Quote
Old 12-04-2002, 09:27 PM   PM User | #5
ConfusedOfLife
Regular Coder

 
Join Date: Jul 2002
Location: Iran
Posts: 695
Thanks: 0
Thanked 0 Times in 0 Posts
ConfusedOfLife is an unknown quantity at this point
Cool

Check this out!

http://www.phpbuilder.com/board/show...eadid=10219750

ConfusedOfLife is offline   Reply With Quote
Old 12-20-2006, 08:35 PM   PM User | #6
fish_liver_oil
New to the CF scene

 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
fish_liver_oil is an unknown quantity at this point
clearing on the command line in php

Hi, using the exec and system commmands might not work,

but if you use the passthru command, combined with the clear bash command, it WILL work. that is:

passthru('clear');

that will clear the screen
fish_liver_oil is offline   Reply With Quote
Old 12-20-2006, 10:27 PM   PM User | #7
ralph l mayo
Regular Coder

 
ralph l mayo's Avatar
 
Join Date: Nov 2005
Posts: 951
Thanks: 1
Thanked 31 Times in 29 Posts
ralph l mayo is on a distinguished road
Thumbs up

sweet thread. I installed php5-cgi just to verify this works:

PHP Code:

function cls()
{
    
array_map(create_function('$a''print chr($a);'), array(27917227915074));

edit: caveat: only tested in xterm and konsole, but I don't see why it wouldn't work on DOS or a television or an etch-a-sketch.

Last edited by ralph l mayo; 12-20-2006 at 10:37 PM..
ralph l mayo is offline   Reply With Quote
Old 12-21-2006, 10:11 AM   PM User | #8
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
Quote:
Originally Posted by ralph l mayo View Post
edit: caveat: only tested in xterm and konsole, but I don't see why it wouldn't work on DOS or a television or an etch-a-sketch.
Quality, havent even heard of an etch-a-sketch for years
__________________
Get Firefox Now
rafiki is offline   Reply With Quote
Old 06-01-2012, 09:59 AM   PM User | #9
z666zz666z
New to the CF scene

 
Join Date: Jun 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
z666zz666z is an unknown quantity at this point
Unhappy

Quote:
Originally Posted by ralph l mayo View Post
sweet thread. I installed php5-cgi just to verify this works:

PHP Code:

function cls()
{
    
array_map(create_function('$a''print chr($a);'), array(27917227915074));

Tested on Windows 7, not working!!

It only shows on screen this: ←[H←[2J
z666zz666z is offline   Reply With Quote
Old 09-16-2012, 11:45 AM   PM User | #10
FrankyBKK
New to the CF scene

 
Join Date: Sep 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
FrankyBKK is an unknown quantity at this point
I had the same problems. After some hours of searching in the internet, I was sure that there are no good answers, I made some experiments. Luckily experiment 3 worked.

This works on all Windows Computers. I guess that it will work on Linux and other systems too, as long as the PHP Console is a HTML Console (any Web Browser) and Javascript is on this Browser activated.

I started this file on my localhost and uploaded the PHP file to my server and started it from there. Both tests did the CLS. I tried it on Windows XP and a friend did a test on Windows 7, and it worked on his Windows 7 too.

It executes on the client's computer in the PHP file an javascript code.


<?php

echo "<script type='text/javascript'>\n";
echo "document.body.innerHTML = ''";
echo "</script>";

?>

Last edited by FrankyBKK; 09-16-2012 at 11:54 AM..
FrankyBKK is offline   Reply With Quote
Old 09-16-2012, 01:03 PM   PM User | #11
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,496
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
That isn't the same thing as what the op was asking 10 years ago Franky. The op was asking how to clear the screen when using php in command line form. PHP is commonly known as a server side language so most people would understand that you can't use it to clear a browser.

The code you've posted is simply javascript. The fact that you're echoing it out via php doesn't mean that its actually php clearing the browser screen.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:45 AM.


Advertisement
Log in to turn off these ads.