HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
HTML Tutorial

CSS Tutorial

Function eregi_replace() is deprecated in php - How to fix



Warning - This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.


Example: How to fix.
<?php
function tep_sanitize_string($string)
{
$string = eregi_replace(' +', ' ', trim($string));
return preg_replace("/[<>]/", '_', $string);
}
?>

how to solve it?
Alternatives to this function eregi_replace() use: preg_replace() (with the i (PCRE_CASELESS) modifier)

Example: use preg_replace()
<?php

function tep_sanitize_string($string)
{
$string = preg_replace(' +', ' ', trim($string));
return preg_replace("/[<>]/", '_', $string);
}
?>




eregi_replace Function eregi_replace() is deprecated in php - How to fix - php tutorial

1936. PHP if, else and elseif Statements, php tutorial
PHP if, else and elseif Statements php tutorial
http://www.agernic.com/php-tutorial/php-if-else-and-elseif-statements.html

3348. PHP convert array to string comma separated, php tutorial
PHP convert array to string comma separated php tutorial
https://www.agernic.com/php-tutorial/php-convert-array-to-string-comma-separated.html

2595. The loop statement: for, do...while, foreach and we add break - continue statement in PHP, php tutorial
The loop statement: for, do...while, foreach and we add break - continue statement in PHP php tutorial
http://www.agernic.com/php-tutorial/for-do-while-foreach-break-continue-in-php.html

3355. PHP Form Variables
Learn about PHP form variables with this PHP tutorial.
https://www.quackit.com/php/tutorial/php_form_variables.cfm

2603. PHP Tutorial - Learn PHP in simple and easy steps starting from basic to advanced, php tutorial
PHP Tutorial - Learn PHP in simple and easy steps starting from basic to advanced php tutorial
http://www.agernic.com/php-tutorial/php-tutorial-learn-php-in-simple-and-easy-steps-starting-from-basic-to-advanced.html

2600. PHP Data Types, php tutorial
PHP Data Types php tutorial
http://www.agernic.com/php-tutorial/php-data-types.html

Your add here
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL BETWEEN Operator
SQL like syntax and example
SQL WHERE AND & OR multiple conditions
SQL create table primary key autoincrement
PHP mysqli_connect () Function
SQL COUNT(), AVG() and SUM() Functions
Display data from SQL database with MySQLi into php - html table
SQL CREATE DATABASE - example
SQL mysql order by columns, by date, by asc, by desc, random with PHP
PHP mysqli_query() Function - mysqli query
SQL delete row - SQL delete table
SQL update - SQL update select
Insert into SQL - Insert into table SQL - Insert data in sql
Login in PHP - simple login script with PHP MYSQL