Search and replace multiple values with multiple/different values in PHP5?

后端 未结 5 2240
日久生厌
日久生厌 2020-11-30 03:35

Is there an inbuilt PHP function to replace multiple values inside a string with an array that dictates exactly what is replaced with what?

For example:



        
5条回答
  •  猫巷女王i
    2020-11-30 03:43

    For what you've got there, just pass that array into str_replace as both the search and replace (using array_keys on the search parameter if you want to keep the array as-is).

提交回复
热议问题