PHP Classes

File: clitest2.php

Recommend this page to a friend!
  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: Update of clitest2.php
Date: 8 months 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";
?>