Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Last active April 12, 2019 04:20
Show Gist options
  • Select an option

  • Save james2doyle/4996998 to your computer and use it in GitHub Desktop.

Select an option

Save james2doyle/4996998 to your computer and use it in GitHub Desktop.
string replace with keys as the search and values as the replace
// 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);
}
@dkzver

dkzver commented Aug 14, 2014

Copy link
Copy Markdown

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment