Here is the trick, in your script use:
system("clear");
To make it work on both Windows and Linux:
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') system("cls"); else system("clear");
I hope this helps someone.
Here is the trick, in your script use:
system("clear");
To make it work on both Windows and Linux:
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') system("cls"); else system("clear");
I hope this helps someone.
How to clean the screen with PHP in Linux (cls, Linux, PHP)RSS feed for comments on this post. TrackBack URL
Hamid Alipour is a partner in Codehead, LLP with his wife, Tess. Hamid speaks 12 markup and programming languages [Yes, 12: PHP, CSS, Ajax, JavaScript, HTML/XHTML, Java, Python, C/C++, ASP, Visual Basic, Scheme and Action Script]; has a penchant for solving the unsolvable; an affinity for clean, hand-written code and is a Zend Certified PHP 5 Engineer. Visit the company website for more information.
Please please please don’t do that
.
for ($i = 0; $i < ; $i++) { print “\n”; }
Is way more portable.
I know it’s not common, but some people will be running PHP on windows.
Comment
William, thanks for your comment but with all respect I disagree…
The code I posted can check for the platform and use “cls” or “clear” and your code won’t produce the desired effect for me.
Comment