Jump to content

function preg_replace


surion

Recommended Posts

hi

 

for work i have to rewrite some stuf, now i find the next function in one of the files:

 

	function remove_accents( $string )
		{
		$string = htmlentities($string);
		$string = preg_replace("/&([a-z])[a-z]+;/i","$1",$string);
		$string = str_replace("-","",$string);
		$string = str_replace("'","",$string);	
		$string = str_replace(" ","",$string);	
		return $string;
		}

 

my question => i don't realy understand that preg_replace function, i know the first variable is a regular expression, and $string is the var where the regular expression should be ran on, but what is that $1 var doing there? since i don't know where it comes from, what it is, what it should be, what it does,... i don't know how to change it to make it work,...

and why is it in between quotes?

Link to comment
Share on other sites

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.