Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use php to verify mailbox ipv6 addresses using filter filters

Shulou Source: shulou.com Published: 2022-06-03 07:43:43 09月16日 Update

This article mainly explains "how to use php to use filter filter to verify email ipv6 address", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "how to use php to use filter filter to verify mailbox ipv6 address"!

1. Verify the mailbox

The copy code is as follows:

$email = 'jb51@qq.com'

$result = filter_var ($email, FILTER_VALIDATE_EMAIL)

Var_dump ($result); / / string (14) "jb51@qq.com"

2. Verify the url address

The copy code is as follows:

$url = "https://www.jb51.net";

$result = filter_var ($url, FILTER_VALIDATE_URL)

Var_dump ($result); / / string (22) "https://www.jb51.net"

3. Verify the ip address

The copy code is as follows:

$url = "192.168.1.110"

$result = filter_var ($url, FILTER_VALIDATE_IP)

Var_dump ($result); / / string (13) "192.168.1.110"

Value, this method can also be used to validate ipv6.

The copy code is as follows:

$url = "2001:DB8:2de::e13"

$result = filter_var ($url, FILTER_VALIDATE_IP)

Var_dump ($result); / / string (17) "2001:DB8:2de::e13"

4. Verify whether the value is an integer and within an integer interval

The copy code is as follows:

$I = '010'

$result = filter_var (

$I

FILTER_VALIDATE_INT

/ / set the numerical range of the check

Array (

'options' = > array (' min_range' = > 1, 'max_range' = > 100)

)

);

Var_dump ($result); / / bool (false)

The variables of php are weakly typed, and it will be true if you don't use a filter and directly use the greater-than-less symbol to judge.

The copy code is as follows:

$I = '010'

$result = $I > = 1 & $I

Tags: Code validation address filter mailbox learning content numerical value integer no interval variable that is ideas situations articles more points knowledge knowledge points Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Information MySQL vpn Microsoft