From JasonAntmanWiki
Jump to: navigation, search

PHP is a highly extensible programming language. Its homepage is here. Though it is commonly thought of only as a web-based programming language, powering projects such as this wiki, it is actually usable in many different applications.

Command Line Use

Ncurses Support

Apparently, PHP's support of ncurses is only experimental at this stage, which is a shame. Ncurses is an extremely popular technology for making text-mode windowed programs.

Sample ncurses/PHP script, borrowed from snipplr:

#!/usr/bin/env php

        // we begin by initializing ncurses 
        $ncurse = ncurses_init(); 

        // let ncurses know we wish to use the whole screen 
        $fullscreen = ncurses_newwin(0, 0, 0, 0);  

        // draw a border around the whole thing. 
        ncurses_border(0,0, 0,0, 0,0, 0,0); 

        // now lets create a small window 
        $small = ncurses_newwin(10, 30, 7, 25); 

        // border our small window. 
        ncurses_wborder($small,0,0, 0,0, 0,0, 0,0); 

        ncurses_refresh();// paint both windows 

        // move into the small window and write a string 
        ncurses_mvwaddstr($small, 5, 5, "   Test  String   "); 

        // show our handiwork and refresh our small window 

        $pressed = ncurses_getch();// wait for a user keypress 

        ncurses_end();// clean up our screen


Some links:
simple article on using PHP ncurses
PHP ncurses FAQ
Official PHP Manual ncurses Page

Notice - this is a static HTML mirror of a previous MediaWiki installation. Pages are for historical reference only, and are greatly outdated (circa 2009).