php/doc-en

Examples for filter_var

开放

#1,475 创建于 2022年3月23日

 (1 条评论) (0 个反应) (0 位负责人)XML (882 个派生)auto 404
Extension: filterenhancementgood first issue

仓库指标

星标
 (596 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

From manual page: https://php.net/function.filter-var


There is no example with if and I saw a lot of implementations like:

if (!filter_var($value, $type)) {
    echo 'error';
}

and it should be:

if (filter_var($value, $type) !== $value) {
    echo 'error';
}

Especially, when you validated with FILTER_VALIDATE_BOOLEAN filter.

贡献者指南