This repository was archived by the owner on Nov 11, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +62
-0
lines changed
Expand file tree Collapse file tree 3 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ /* VALID FORMAT */
6+
7+ $ raw = '10/01/2014 ' ;
8+
9+ $ filtered = Filter \Filter::date ($ raw );
10+
11+ echo 'yyyy/mm/dd: ' . $ filtered . PHP_EOL ;
12+
13+ /* INVALID FORMAT */
14+
15+ $ raw = '32/01/2000 ' ;
16+
17+ $ filtered = Filter \Filter::date ($ raw );
18+
19+ if (is_null ($ filtered ))
20+ echo 'Invalid date format. ' . PHP_EOL ;
21+ else
22+ echo 'This is not going to be displayed. ' . PHP_EOL ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ /* USING DOT */
6+
7+ $ raw = '10.2 ' ;
8+
9+ /* INTEGER */
10+
11+ echo Filter \Filter::int ($ raw ) . PHP_EOL ;
12+
13+ /* FLOAT */
14+
15+ echo Filter \Filter::float ($ raw ) . PHP_EOL ;
16+
17+ /* USING COMMA */
18+
19+ $ raw = '10,2 ' ;
20+
21+ /* INTEGER */
22+
23+ echo Filter \Filter::int ($ raw ) . PHP_EOL ;
24+
25+ /* FLOAT */
26+
27+ echo Filter \Filter::float ($ raw ) . PHP_EOL ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once __DIR__ . '/../vendor/autoload.php ' ;
4+
5+ /* RAW STRING */
6+
7+ $ raw = '<script>alert();</script> ' ;
8+
9+ echo Filter \Filter::string ($ raw ) . PHP_EOL ;
10+
11+ /* NO TAGS */
12+
13+ echo Filter \Filter::noTags ($ raw ) . PHP_EOL ;
You can’t perform that action at this time.
0 commit comments