<?php $options = array(0, 'Create Table', 'Trunctable', 'Drop', 'Delete', 'Select', 'Conditions'); unset($options[0]); $stdin = fopen('php://stdin', 'r'); if ($stdin === false) die(42); do { echo 'What would you wanna do ?', "\n"; $input = intval(fgets($stdin)); } while (!isset($options[$input])); fclose($stdin); echo $options[$input], "\n"; ?>
<?php function create_table() { echo 'Create Table', "\n"; } function truncable() { echo 'Trunctable', "\n"; } function drop() { echo 'Drop', "\n"; } $options = array(0, 'create_table', 'truncable', 'drop', 'delete', 'select', 'conditions'); unset($options[0]); $stdin = fopen('php://stdin', 'r'); if ($stdin === false) die(42); do { echo 'What would you wanna do ?', "\n"; $input = intval(fgets($stdin)); } while (!isset($options[$input])); fclose($stdin); if (!is_callable($options[$input])) die(21); call_user_func($options[$input]); ?>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question