PHP code example of bigpaulie / dynamic-form-validation
1. Go to this page and download the library: Download bigpaulie/dynamic-form-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/ */
bigpaulie / dynamic-form-validation example snippets
$rules = ['/input_name_([0-9]+)/i' => 'filter_name'];
$validator = new Validator();
$validator->setRules($rules)->setRequest($request);
try {
if ( $validator->run() ) {
echo "Validation successful.";
} else {
echo "Validation failed.";
}
} catch ( \Exception $e ) {
echo $e->getMessage();
}