Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:45:37+00:00 2026-06-03T06:45:37+00:00

I have a user defined function below: function char_replace($line1){ $line1= str_ireplace(Snippet:, , $line1); //

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:45:38+00:00Added an answer on June 3, 2026 at 6:45 am

    Assuming that you end your function with return $line1; you can call it like this:

    $line1 = char_replace($line1);
    $line2 = char_replace($line2);
    $line3 = char_replace($line3);
    

    How you call the arguments in your function definition doesn’t matter, they’re local to that function and can have a different name outside of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this user defined function. public partial class UserDefinedFunctions { static int i;
I have a User Defined Function (UDF) written in Java to parse lines in
Most systems will have a user-defined function (UDF) available. Some will not. i want
I have an user defined table function in SQL Server that aggregate data from
I have a table a with a list of id's, and a user-defined function
Suppose I have a user defined type: CREATE OR REPLACE TYPE TEST_TYPE AS OBJECT
Suppose i have a function template StrCompare template<typename T=NonCaseSenCompare>//NonCaseSenCompare is a user defined class
I have a user-defined table type. I want to check it's existence before editing
I have a class that defined a user defined operator for a TCHAR*, like
I have a script which creates a user-defined object like this: obj = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.