Skip to content

Instantly share code, notes, and snippets.

@rxu
Created August 15, 2017 04:18
Show Gist options
  • Save rxu/778e85a2b50d3633f8fbe9f1f0b5ed25 to your computer and use it in GitHub Desktop.
Save rxu/778e85a2b50d3633f8fbe9f1f0b5ed25 to your computer and use it in GitHub Desktop.
Blind ternary
preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER) ?:
preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $template, $matches, PREG_SET_ORDER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment