-
-
Save victorknust/9786100 to your computer and use it in GitHub Desktop.
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
| <?php | |
| $oParser = new Parser(); | |
| // Here we give values to the tags the parser can expect in the content. | |
| $aTagValues = array( | |
| 'name' => 'Bruno', | |
| 'title' => 'M.A.' | |
| ); | |
| $sContent = "Dear {{title}} {{name}}, we are spamming you to sell you canned beans."; | |
| // Parsing by return value. | |
| $sContent = $oParser->doParse($aTagValues, $sContent); | |
| // You can also parse by reference and chain the | |
| // Parser (doParseRef returns the Parser instance), | |
| // but be careful - the original string is then modified | |
| // $oParser->doParseRef($aTagValues, $sContent); | |
| die($sContent); //Produces. "Dear M.A. Bruno, we are spamming you to sell you canned beans." | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment