Created
March 18, 2016 11:38
-
-
Save tobsn/912017463dedd5899004 to your computer and use it in GitHub Desktop.
super simple token replace
This file contains 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
$G['c2'] = 'bar'; | |
$r='http://google.com/?s1=#c1#&s2=#c2#'; | |
$r=preg_replace('/#([^#]+?)#/sUe','$G{"$1"}',$r); | |
http://google.com/?s1=&s2=bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment