SPL-StandardPHPLibrary
dba_array.php
Go to the documentation of this file.
1 <?php
2 
17 if ($argc < 4) {
18  echo <<<EOF
19 Usage: php ${_SERVER['PHP_SELF']} <file> <handler> <key> [<value>]
20 
21 If <value> is specified then <key> is set to <value> in <file>.
22 Else the value of <key> is printed only.
23 
24 
25 EOF;
26  exit(1);
27 }
28 
29 if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
30 
31 try {
32  if ($argc > 2) {
33  $dba = new DbaArray($argv[1], $argv[2]);
34  if ($dba && $argc > 3) {
35  if ($argc > 4) {
36  $dba[$argv[3]] = $argv[4];
37  }
38  var_dump(array('Index' => $argv[3], 'Value' => $dba[$argv[3]]));
39  }
40  unset($dba);
41  }
42  else
43  {
44  echo "Not enough parameters\n";
45  exit(1);
46  }
47 }
48 catch (exception $err) {
49  var_dump($err);
50  exit(1);
51 }
52 ?>
This implements a DBA Array.
Definition: dbaarray.inc:19