PHP code example of multidimensional / array-validation

1. Go to this page and download the library: Download multidimensional/array-validation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

multidimensional / array-validation example snippets


use Multidimensional\ArrayValidation\Validation;

$rules = ['keyName' => ['type' => 'string', '

$array = ['keyName' => 'text'];
$bool = Validation::validate($array, $rules);
echo $bool; //true

$rules = [
  'a' => ['type' => 'string', 'ed' => [
	  'a' => 'banana'
	 ]
  ],
  'c' => ['type' => 'string',
    ''pickle'
	  ],
	  [
		'b' => 'banana'
	  ]
	]
  ]
];

$rules = ['a' => ['type' => 'string', 'values' => ['cat', 'dog']]];
ValidationTest.php