<?php foreach ( [ 'array' => ['foo'], 'string' => 'foo', 'int' => 3, 'class' => new stdClass(), 'good input' => 'foo@bar.com' ] as $inputName => $input) { foreach ( [ 'validate' => FILTER_VALIDATE_EMAIL, 'sanitize' => FILTER_SANITIZE_EMAIL, ] as $filerName => $filter ) { foreach( [ 'none' => [], 'default of int 5' => ['options' => ['default' => 5]], 'default with null failure' => ['flags' => FILTER_NULL_ON_FAILURE, 'options' => ['default' => 5]], 'null failure' => ['flags' => FILTER_NULL_ON_FAILURE], 'default with null failue and force array' => ['flags' => FILTER_NULL_ON_FAILURE | FILTER_FORCE_ARRAY, 'options' => ['default' => 5]], 'default with force array' => ['flags' => FILTER_FORCE_ARRAY, 'options' => ['default' => 5]], 'force array' => ['flags' => FILTER_FORCE_ARRAY], ] as $optionsName => $options) { echo "$inputName\t$filerName\t$optionsName\n"; var_dump(filter_var($input, $filter, $options)); } } }
You have javascript disabled. You will not be able to edit any code.
This script was stopped while abusing our resources