Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define("REGEXP_MULTIPLE_NAMES", "/^[a-zA-Zs-]+$/i");
- //Expression to check Dutch phone numbers. Number must start with zero and number of digits should be 10. Different area and country codes are allowed.
- define("REGEXP_PHONE_NL", "/(^+[0-9]{2}|^+[0-9]{2}(0)|^(+[0-9]{2})(0)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9-s]{10}$)/");
- $data = array(
- 'city' => 'The hague',
- 'telephonenr' => '0701234567'
- );
- $args = array(
- 'city' => array(
- 'filter' => FILTER_VALIDATE_REGEXP,
- array(
- "options" => array(
- "regexp" => REGEXP_MULTIPLE_NAMES
- )
- )
- ),
- 'telephonenr' => array(
- 'filter' => FILTER_VALIDATE_REGEXP,
- array(
- 'options' => array(
- "regexp" => REGEXP_PHONE_NL
- )
- )
- )
- );
- $myinputs = filter_var_array($data, $args);
- print_r($myinputs);
- $args = array(
- 'city' => array(
- 'filter' => FILTER_VALIDATE_REGEXP,
- 'options' => array(
- "regexp" => REGEXP_MULTIPLE_NAMES
- )
- ),
- 'telephonenr' => array(
- 'filter' => FILTER_VALIDATE_REGEXP,
- 'options' => array(
- "regexp" => REGEXP_PHONE_NL
- )
- )
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement