Workaround / alternative for obsolete eregi_replace [duplicate]

0

I'm getting the following error:

Deprecated: Function eregi_replace() is deprecated in C:\wamp\www\ajax\paginator.inc.php on line 202  

This is a line of a script that does pagination with php + mysql + ajax

Line 202:

$_pagi_sqlConta = eregi_replace("select[[:space:]](.*)[[:space:]]from", "SELECT COUNT(*) FROM", $_pagi_sql);  

Much of the querys are obsolete, and I'm adapting from mysql to mysqli. However, 'eregi_replace' I did not know until now, and after searching, I could not find a workaround / alternative for it.

    
asked by anonymous 30.12.2015 / 15:01

1 answer

2

Replace with preg_replace and take the test.

$_pagi_sqlConta = preg_replace("/select[[:space:]]'\(.*\)'[[:space:]]from/", "SELECT COUNT(*) FROM", $_pagi_sql);  
    
30.12.2015 / 15:05