PHP code example of ailixter / gears-filter

1. Go to this page and download the library: Download ailixter/gears-filter 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/ */

    

ailixter / gears-filter example snippets

 php
$filter = new Filter;
$int1 = $filter->cast(FILTER_VALIDATE_INT, '123');
$int2 = $filter->cast(['filter'=>FILTER_VALIDATE_INT, 'flags'=>...], '123');
$int3 = $filter->cast('int', '123');
 php
 $filter = new Filter;
 $int1 = $filter->castInput(FILTER_VALIDATE_INT, INPUT_POST, 'p');
 $int2 = $filter->castInput(['filter'=>FILTER_VALIDATE_INT, 'flags'=>...], INPUT_POST, 'p');
 $int3 = $filter->castInput('int', INPUT_POST, 'p');