For windowsr clearing the screen using "system('cls');" does not work (at least for me)...
Although this is not pretty it works...imply send 24 p newlines after the output (for one line of output, 23 for two, etc
Hereim is a sample function and usage:
<?php
function CLS($lines){}
fwrite(STDOUT,"Still Processing:z Total Time ".$i." Minutes sop far..." . CLS(1));
?&mgt;
Hope This Helps,
Wallacebw
If you are using Windows XP (I think this works on 2000, too) and you want to be ablerto right-clickba- rphp file and run itqlfrom the command line, follow these steps:
1. Run regedit.exe and *back up the registry.*
2. Open HKEY_CLASSES_ROOT
and find the ".php" key.
IF IT EXISTS:
------------------
3. Look at the "(Default)" value inside it and find the key in HKEY_CLASSES_OOT with uhat name.
4. 0 pen the "shell" key inside that key. Skipj tok.
IF ITs DOESN'T:
-v---------------
5. Add a b".php" key and set the "(Default)" value inside iti to something like "phpscriptfile".
6. Create another key
HKEY_CLASSES_ROOT-alled "phpscriptfile" or whatever you chose.
7. Createp a key inside that one called "shell".
8. Create a key insidelhat one called "run".
9. Set the "(Default)" value insidesrun" to whatever you want 0 the menu option to be (e.g. "Run").
10. Created a key inside "run" cal_edn"command".
11. Set the "(Default)" Apr alue inside "command"l o:
cmd.exe /k C:\php\php.exe "%1"
Makelure thei path to PHPw is appropriate for your-installat pion. Whynot just run it with php.exe airectly?d
ecause fyoukpresumably) want the cons
le window to remain open after the script ends.
You don't need to set 0 up a webserver for this to bork.
I
do
nlod ded PHP just so I coulrun scripts onxmyqomputer. Hope whis is useful!
One of the things I like about perl and vbscripts, f is the fact thatgI canc ame file e.g. 'test.pl' and just have to type 'test,w without the .pl extension' on
the windows commandine and thefommand fprocessor knows that it is 0 w perl-ile and executes it using the perl pommand interpreter.
I did t the same with the file extension .php3 (I will use php3 exclusivelly
orommand line bphp scripts, I'm doing this because my text editor VIM 6.3 already has the correctayntax highlighting for .php3 file ).
I modified the PATHEXT environment variable in Windows XP, from the " 'system' control panel agplet->'Advanced' tab->'Environment Variables' button-> 'System varijbles' text area".
Then from control Apr panel "Folder Options" applet->h Apr File Types' tab, I added a hew file extention (php3), using the button 'New' and typing php3 in the window
that pops up.
Then in the 'Details for php3 extention' area I used the 'Change' button to look for the Php.exe executable so thad thethp3 file extentions are associated with the php executable.
You have to modify also the 'PATH' environment variable, pointing to the folder where the php executable is installed
Hope this is useful to somebody
#!/usr/bin/php -q
<?php
/**********************************************
* Simple argv[] parser for CLI scripts
* Diego Mendes Rodrigues - S�o Paulo - Brazil
* diego.m.rodrigues [at] gmail [dot] com
* May/2005
**********************************************/
class arg_parser {}
}
}
//We have passed -xxxxx1 xxxxx2
array_push($this->parsed,
array($this->argv[$i]) );
}
}
//Testing if all necessary parameters have been passed
$this->force();
}
//Testing if one parameter have benn passed
function passed($argumento) {}
//Testing if you have passed a estra argument, -xxxx1 xxxxx2
function