Viewed   296 times

I have written following PHP code:

$input="menu=1&type=0&";

print $input."<hr>".ereg_replace('/&/', ':::', $input);

After running above code, it gives following warning,

Deprecated: Function ereg_replace() is deprecated

How can I resolve this warning.

 Answers

5

Switch to preg_replaceDocs and update the expression to use preg syntax (PCRE) instead of ereg syntax (POSIX) where there are differencesDocs (just as it says to do in the manual for ereg_replaceDocs).

Friday, December 9, 2022
5

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

you can use preg_match().

Friday, August 26, 2022
 
3

I think you want preg_split.

list($year, $month, $day, $hour, $min, $sec) = preg_split('/[: -]/', $post_timestamp);
Wednesday, December 14, 2022
3

Use preg_replace instead, just add delimiters.

$row[$j] = preg_replace("#n#", "\n", $row[$j]);
Wednesday, December 14, 2022
1

You can use either the --trace-deprecation or --throw-deprecation options.

For example:

node --trace-deprecation app.js

or:

node --throw-deprecation app.js

The first option will log a stack trace and the second will throw an error (which, if not caught, will also log a stack trace).

Also, 4346 is most likely the process ID.

Monday, October 31, 2022
 
lvc
 
lvc
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :