I have a user defined function below:
function char_replace($line1){
$line1= str_ireplace("Snippet:", "", $line1);
// First, replace UTF-8 characters.
$line1= str_replace(
array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"),
array("'", "'", '"', '"', '-', '--', '...'),
$line1);
// Next, replace their Windows-1252 equivalents.
$line1= str_replace(
array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)),
array("'", "'", '"', '"', '-', '--', '...'),
$line1);
}
and i'm replacing characters on multiple lines that i've exploded, except i want to apply a dynamic argument to the function char_replace where $line
could very well be $line2
or $line3
so i would convert the characters this way:
$line1 = char_replace($line1)
I want to make the function arguments and the str_replace/str_ireplace arguments to be a dynamic variable, where i could just convert another line like so:
$random_line = char_replace($random_line)
Is this possible?