PHP Classes
elePHPant
Icontem

File: clitest2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gaspar  >  PHP CLI Input  >  clitest2.php  >  Download  
File: clitest2.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CLI Input
Process keys pressed by the user in the shell
Author: By
Last change:
Date: 1 year ago
Size: 581 bytes
 

Contents

Class file image Download
<?php

require_once('CLIInput.class.php');

function
testString($string, $state, $options)
{
  return array(
'string' => 'Crash Test Dummy',
          
'pos' =>2);
}

function
testString2($string, $state, $options)
{
  return array(
'string' => strtoupper($string));
}

function
emptyExit($string, $state, $options)
{
  return array(
'string' => '',
          
'end' => true);
}

echo
"Enter your name: ";
$input = new CLIInput();
$text = $input->read(20,
             array(
'up' => 'testString',
              
'down' => 'testString2',
              
'escape' => 'emptyExit'));
echo
"\n\nRESULT: ".$text."\n";
?>