PHP code example of multidimensional / array-sanitization
1. Go to this page and download the library: Download multidimensional/array-sanitization 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-sanitization example snippets
use Multidimensional\ArraySanitization\Sanitization;
$rules = ['keyName' => ['type' => 'integer']];
$array = ['keyName' => 10.1];
$result = Sanitization::sanitize($array, $rules);
print_r ($result);
/*
* $result = array('keyName' => 10);
*/
SanitizationTest.php