Back to index

php5  5.3.10
dba_array.php
Go to the documentation of this file.
00001 <?php
00002 
00017 if ($argc < 4) {
00018        echo <<<EOF
00019 Usage: php ${_SERVER['PHP_SELF']} <file> <handler> <key> [<value>]
00020 
00021 If <value> is specified then <key> is set to <value> in <file>.
00022 Else the value of <key> is printed only.
00023 
00024 
00025 EOF;
00026        exit(1);
00027 }
00028 
00029 if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
00030 
00031 try {
00032        if ($argc > 2) {
00033               $dba = new DbaArray($argv[1], $argv[2]);
00034               if ($dba && $argc > 3) {
00035                      if ($argc > 4) {
00036                             $dba[$argv[3]] = $argv[4];
00037                      }
00038                      var_dump(array('Index' => $argv[3], 'Value' => $dba[$argv[3]]));
00039               }
00040               unset($dba);
00041        }
00042        else
00043        {
00044               echo "Not enough parameters\n";
00045               exit(1);
00046        }
00047 }
00048 catch (exception $err) {
00049        var_dump($err);
00050        exit(1);
00051 }
00052 ?>