1. CSS
  2. Flash
  3. HTML
  4. Illustrator
  5. Java
  6. JavaScript
  7. Maya
  8. Photography
  9. Photoshop
  10. PHP
  11. Ruby
  12. Ruby on Rails
  13. 3ds Max

PHP: How to use an associative array with PHP's str_replace function

  1. Clicks today:
    0
  2. Clicks this month:
    0
  3. Overall rating:
    3.00/5

PHP » Basics — over 10 years ago
If you are a PHP developer, I'm sure you know the str_replace function for replacing strings and are probably aware that you can pass an array of strings as the search strings and an array as the replacements. What this post looks at is a way of using a single associative array instead of two arrays, which makes dealing with a large number of replacements much more maintainable in your code.

Comments

Your Comment

You must be logged in to post a comment.