Created
April 24, 2017 19:35
-
-
Save hultberg/23f89f7c476c6db3ad6477dc5bedbfd3 to your computer and use it in GitHub Desktop.
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
<?php | |
function compile($data) { | |
// Compile variables: | |
// var = $value | |
// | |
// into: | |
// $var = $value | |
$data = preg_replace('/[a-Z]/im', ''); | |
// Compile: | |
// if $cond | |
// | |
// into: | |
// if ($cond) { | |
$data = preg_replace('/if (.*)/im', 'if ($1) {', $data); | |
return $data; | |
} | |
echo compile('if value == 1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment