Last active
April 12, 2019 04:20
-
-
Save james2doyle/4996998 to your computer and use it in GitHub Desktop.
string replace with keys as the search and values as the replace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // use keys as search and values as replace | |
| function str_replace_assoc(array $replace, $subject) { | |
| return str_replace(array_keys($replace), array_values($replace), $subject); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good