PHP code example of romeoz / rock-sanitize
1. Go to this page and download the library: Download romeoz/rock-sanitize 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/ */
romeoz / rock-sanitize example snippets
use rock\sanitize\Sanitize;
Sanitize::removeTags()
->lowercase()
->sanitize('<b>Hello World!</b>');
// output: hello world!
use rock\sanitize\Sanitize;
$input = [
'name' => '<b>Tom</b>',
'age' => -22
];
$attributes = [
'name' => Sanitize::removeTags(),
'age' => Sanitize::abs()
];
Sanitize::attributes($attributes)->sanitize($input);
/*
output:
[
'name' => 'Tom',
'age' => 22
]
*/
// all attributes:
Sanitize::attributes(Sanitize::removeTags())->sanitize($input);