tags:

views:

138

answers:

4

I am getting the below message on my sites page there are more than 20 messages like this... pls guide me to rectify the issue... I am using the PHP 5.3.0

Deprecated: Function eregi() is deprecated in C:\wamp\www\bannerbuzz\includes\classes\language.php on line 87

> UPDATE : Is there any way to switch off this display of error?

A: 

Try preg_match or preg_replace, functions that aren't depreciated :)

For changing the error level:

http://php.net/manual/en/function.error-reporting.php

Dan Heberden
I think you mean *deprecated*.
Will Vousden
And I Think Will is not aware of Humour :)
OM The Eternity
Heh, I thought it was a good play on the word :p
Dan Heberden
+2  A: 

Perhaps because the function is deprecated? You can always change the error_reporting settings, but it's better that you stop using deprecated functions!

From PHP.net:

This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

I believe it is also removed as of PHP 6. Why not just use preg_match?

animuson
+2  A: 

In PHP 5.3, there are certain things that are deprecated, that is no more supported, however, there exists an alternative for them in php 5.3 for you to use.

See complete list of:

Deprecated features in PHP 5.3.x

Note: The ereg is removed, you can use preg family of functions instead.

Sarfraz
See UpdatedQuestion
OM The Eternity
@OM The Eternity: You should not switch of the display of errors if you want to see what functions are depracated otherwise your site might not give the expected results and calculations. Howerver try this but i am not sure whether it will work with deprecated functions errors. `ini_set('display_errors', false);`
Sarfraz
Ok I guess its better to change the functions isnt it?
OM The Eternity
@OM The Eternity: That is the way to go :)
Sarfraz
@Sarfraz: As of 5.3 E_DEPRECATED is it's own trigger that turning off error reporting would hide but I shudder at the approach
Dan Heberden
@Dan Heberden: That is useful and rightly said in terms of not hiding it :)
Sarfraz
+1  A: 

The correct answer to your question is: use a different error setting on your site. You can do that in one of 3 ways.

Change the php.ini file, if you have the right to.

error_reporting  =  E_ERROR
display_errors = Off

Add an .htaccess file to the root directory of your site You also have to have the right to do this. Add the following lines:

php_flag display_errors off
php_value error_reporting E_ERROR

Execute the following statements in the beginning of your script

error_reporting(E_ERROR);
ini_set("display_errors","Off");

However, in concurrence with the other answers given, the errors you get are errors and you should resolve them. Most of the time you want to show errors in your development environment and suppress and log them in your production environment. But you always want to solve them.

Check out the PHP manual for more info on errors.

Niels Bom