Jump to content

[SOLVED] Deprecated: Function eregi_replace() is deprecated in C:\jkj\jhj line 37


Recommended Posts

Definition of deprecated

 

# In computer software standards and documentation, the term deprecation is applied to software features that are superseded and should be avoided. ...

en.wikipedia.org/wiki/Deprecated

 

# Strongly disapproved of; Belittled; insulted; Obsolescent; said of a construct in a computing language considered obsolete but still available ...

en.wiktionary.org/wiki/deprecated

 

# deprecation - the act of expressing disapproval (especially of yourself)

wordnetweb.princeton.edu/perl/webwn

 

# deprecating - In manner that deprecates; insulting; belittling

en.wiktionary.org/wiki/deprecating

 

# deprecate - to express disapproval of; to recommend against use of; to pray against

en.wiktionary.org/wiki/deprecate

 

# deprecation - The act of deprecating; A praying against evil; prayer that an evil may be removed or prevented; strong expression of disapprobation; Entreaty for pardon; petitioning; An imprecation or curse

en.wiktionary.org/wiki/deprecation

 

# functions or template tags are no longer supported, and will soon be obsolete.

codex.wordpress.org/Glossary

 

# A deprecated element or attribute is one that has been outdated by newer constructs. Deprecated elements may become obsolete in future versions of HTML . Authors should avoid using deprecated elements and attributes. ...

www.d.umn.edu/itss/support/Training/Online/webdesign/glossary/d.html

 

preg_replace is the way of teh future man.

thank you for the clarification and now i have set up this code below and how do i rewrite the line with eregi_replace using the new preg_replace. becoz i simply substituted eregi_replace with preg_replace and I am getting errors about my delimiters but i am not sure what to do.  Hope u can help.  these are the 2 lines: $site_url = eregi_replace('index.php', '', $full_url); and $label = eregi_replace('_', ' ', $getdirArray[$dir]);  and the full code below:

 

$hits = null;
$full_url = $_SERVER['PHP_SELF'];
$site_url = eregi_replace('index.php', '', $full_url);
$directory_list = array('data', 'moredata');

foreach($directory_list as $dirlist)
{
	$directory_url = $site_url.$dirlist."/";
	$getDirectory = opendir($dirlist);

	while($dirName = readdir($getDirectory))
		$getdirArray[] = $dirName;

	closedir($getDirectory);

	$dirCount = count($getdirArray);
	sort($getdirArray);

	for($dir=0; $dir < $dirCount; $dir++)
	{
		if (substr($getdirArray[$dir], 0, 1) != ".")
		{
			$label = eregi_replace('_', ' ', $getdirArray[$dir]);

			$directory = $dirlist.'/'.$getdirArray[$dir]."/";
			$complete_url = $site_url.$directory;

			if(is_dir($directory))
			{
				$myDirectory = opendir($directory);

				$dirArray = null;

				while($entryName = readdir($myDirectory))
					$dirArray[] = $entryName;

				closedir($myDirectory);

				$indexCount = count($dirArray);
				sort($dirArray);
			}

delimiters are something you use in PCRE regex (the "preg functions") other than POSIX regex (the "ereg functions")

 

for example..

$string = "I eat deer"
preg_replace("/deer/", 'dogs', $string);

 

would be done like this in "ereg" form

 

$string = "I eat deer"
ereg_replace("deer", 'dogs', $string);

 

notice the difference? the slashes. //

you can also use !@#$%^&* (all those wacky characters where the numbers are... holding SHIFT)

 

what's the strategy in it? To keep you from having to escape slashes.

thank you soo much zanus you are indeed a star, my search engine is now up and running.  But honestly why did they make the new preg_replace() so complicated.  I think the old one eregi_replace() was simple..u didnt need to use all those delimiter things.

 

thanks and hv a nice day.

But honestly why did they make the new preg_replace() so complicated.  I think the old one eregi_replace() was simple..u didnt need to use all those delimiter things.

When you get used to it, it's no more difficult for simple regular expressions (just a couple of extra characters); supports more complex regular expressions; you only need one function for case-sensitive and for case-insensitive (not two different functions); it's a lot faster than the old ereg_replace
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.