&reftitle.examples;
検証 <function>filter_var</function> でのメールアドレスの検証 ]]> &example.outputs; <function>filter_var</function> での IP アドレスの検証 ]]> &example.outputs; <function>filter_var</function> でのオプションの指定 array( 'min_range' => 0, 'max_range' => 3, ) ); if (filter_var($int_a, FILTER_VALIDATE_INT, $options) !== FALSE) { echo "整数値 A '$int_a' は有効な値 (0 から 3 までの間) です。\n"; } if (filter_var($int_b, FILTER_VALIDATE_INT, $options) !== FALSE) { echo "整数値 B '$int_b' は有効な値 (0 から 3 までの間) です。\n"; } if (filter_var($int_c, FILTER_VALIDATE_INT, $options) !== FALSE) { echo "整数値 C '$int_c' は有効な値 (0 から 3 までの間) です。\n"; } $options['options']['default'] = 1; if (($int_c = filter_var($int_c, FILTER_VALIDATE_INT, $options)) !== FALSE) { echo "整数値 C '$int_c' は有効な値 (0 から 3 までの間) です。"; } ?> ]]> &example.outputs;
除去 メールアドレスの検証、および不正な部分の除去 ]]> &example.outputs;