Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
isWhat.inc.php
SUBMITTED BY:
Guest
DATE:
Dec. 6, 2013, 10:04 a.m.
FORMAT:
PHP
SIZE:
1.4 kB
Raw
Download
Tweet
HITS:
925
Go to comments
Report
<?php
function
isWhat
(
$IWstring
,
$IW
)
{
$WPM
=
NULL
;
if
(
strlen
(
$IWstring
)
==
NULL
)
{
return
0
;
}
else
{
if
(
$IWstring
!=
NULL
)
{
switch
(
$IW
)
{
case
'email'
:
$WPM
=
'/^[_a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,6}$/'
;
break
;
case
'hp'
:
$WPM
=
'/^[(http:\/\/)]+[a-zA-Z0-9-.]+$/'
;
break
;
case
'decimal'
:
$WPM
=
'/^[0-9]{1,}+\.[0-9]{2,}+$/'
;
break
;
default
:
$WPM
=
NULL
;
break
;
}
if
(
$WPM
!=
NULL
)
{
if
(
!
preg_match
(
$WPM
,
$IWstring
)
)
{
return
0
;
}
else
return
1
;
}
else
return
0
;
}
}
}
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus