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 936035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:15:00+00:00 2026-05-15T21:15:00+00:00

In PHP, you do this to replace more then one value at a time.

  • 0

In PHP, you do this to replace more then one value at a time.

<?php
$string = "i am the foobar";

$newstring = str_replace(array('i', 'the'), array('you', 'a'), $string);

echo $newstring;
?>

How do you do this in javascript?

  • 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-05-15T21:15:00+00:00Added an answer on May 15, 2026 at 9:15 pm

    Use javascript’s .replace() method, stringing multiple replace’s together. ie:

    var somestring = "foo is an awesome foo bar foo foo"; //somestring lowercase
    var replaced = somestring.replace(/foo/g, "bar").replace(/is/g, "or");
    // replaced now contains: "bar or an awesome bar bar bar bar"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do use php/regex to replace this: {{image-4-m}} to this: <img src=4.jpg
i want the best regular expression to replace this code <a href=http:// www.badoobook.com/clips/index.php?page=videos&section=view&vid_id=100162> www.badoobook.com/clips/inde......&vid_id=100162
I have got jquery post function jQuery('.more-button').live('click', function(eve){ var page = jQuery(this).attr('id').replace('more-button-',''); loaded_messages +=
I am new to PHP and I am trying to work on this one
Im using this piece of code: <?php $newstring = preg_replace(/[\n\r]/, <br /> , $googlemapsbox_text);
I want to run this PHP function -- $querystring_arr='maxResults=50&startIndex=50&sort=date'; $str=preg_replace((&startIndex=)?[0-9]*(&)?,&startIndex=.$sindex.&,$querystring_arr); When I print $str
What is the c#.net equivalent for php's preg_replace function? php code is like this:
What does this pattern '/\\\(?!&amp;#|\?#)/' match in PHP preg_replace function? Is this pattern valid?
In php this is how you would check if a file is selected: $_FILES['item']['size']>0
After ages of programming in php this question seems really weird still to me.

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.