Jump to content

eregi deprecated


prezident

Recommended Posts

here my code

<html>
    <head><title>TESTING</title></head>
    
    <body>
        <form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>"/>
        email: <input type=text name=email value="" /><br/>
        feedback: <input type=text name=ex value=""/><br/>
        <input type="submit" value="submit" /><br/>
    </body>
</html>

<?php
$email = $_GET['email'];
$ex = $_GET['ex'];

if(!eregi('^[a-zA-Z0-9\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z]+$',$email)){
    echo 'invalid email address<br/>'; 
} else { echo 'good to go<br/>'; }

if(eregi('money|brooklyn|new york' ,$ex)){
    echo '1';
} else { echo '0'; }

?>

 

The code works fine but when i put on my error reporting i get that eregi is deprecated, now if eregi is depreciated which function should i use ? or should i just suppress the error ?

Link to comment
https://forums.phpfreaks.com/topic/224091-eregi-deprecated/
Share on other sites

DEPRECATED http://en.wikipedia.org/wiki/Deprecation

 

eregi replacement: http://php.net/manual/en/function.preg-match.php

 

Since the function is deprecated, it will be removed in a future version of PHP. If you suppress the error, your code is liable stop working for an unknown reason after eregi is removed.

 

Link to comment
https://forums.phpfreaks.com/topic/224091-eregi-deprecated/#findComment-1157928
Share on other sites

Since the function is deprecated, it will be removed in a future version of PHP. If you suppress the error, your code is liable stop working for an unknown reason after eregi is removed.

 

Well the unknown reason is known, because it will have been removed! He just won't know it at the time!  :P

Link to comment
https://forums.phpfreaks.com/topic/224091-eregi-deprecated/#findComment-1157933
Share on other sites

Since the function is deprecated, it will be removed in a future version of PHP. If you suppress the error, your code is liable stop working for an unknown reason after eregi is removed.

 

Well the unknown reason is known, because it will have been removed! He just won't know it at the time!  :P

 

well i know now so.... when that time comes i guess i won't know cause i won't be using that function :P lol

Link to comment
https://forums.phpfreaks.com/topic/224091-eregi-deprecated/#findComment-1157934
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.