Php - please help to find two alternatives for ereg functions
Posted
by Guanche
on Stack Overflow
See other posts from Stack Overflow
or by Guanche
Published on 2010-04-03T15:53:38Z
Indexed on
2010/04/03
16:03 UTC
Read the original article
Hit count: 324
ereg and eregi functions will be deleted from Php. Please help to find alternatives for the following ereg functions:
1) To allow IP addresses only for specific ranges:
$targetAddr = "60.37..*..*";
if (!ereg($targetAddr, $_SERVER['REMOTE_ADDR'])) {
die;
}
2) To replace series of points like .......................
$message = ereg_replace("[.]{3,}", "... ", $message);
© Stack Overflow or respective owner