コード例 #1
0
 /**
  * Initialize the UT.
  *
  * @return void
  */
 protected function setUp()
 {
     $autoload = new PHP_Validate_Autoload();
     $autoload->register();
     $this->_data['id'] = 22;
     $this->_data['name'] = "nicolas";
     $this->_data['nodes'] = $this->_values;
     $this->_data = new PHP_Validate($this->_data);
 }
コード例 #2
0
<?php

ini_set("error_reporting", E_ALL);
ini_set("display_errors", true);
require_once "PHP/Validate/Autoload.php";
$autoload = new PHP_Validate_Autoload();
$autoload->register();
$_GET['id'] = 22;
$_GET['name'] = "nicolas";
$_GET['nodes'] = array("a" => 12, 13, 14);
$_GET['matrix'] = array("a" => array("b" => 14), 13, 14);
$_GET = new PHP_Validate($_GET);
echo $_GET->getInt("id") . chr(10);
echo $_GET["nodes"]->getInt("a") . chr(10);
echo $_GET["matrix"]["a"]->getInt("b") . chr(10);
die;
// echo $_GET->getString("name", "HTML") . chr(10);
// echo $_GET["nodes"]->getInt("a") . chr(10);
// $nodes = $_GET["nodes"];
// foreach ($nodes as $key=>$value) {
//     echo $key .chr(10);#cannot use the key null value returned
//     echo $value->toInt() .chr(10);
// }