Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. function compile($data) {
  5.  
  6. // Compile variables:
  7. // var = $value
  8. //
  9. // into:
  10. // $var = $value
  11. $data = preg_replace('/[a-Z]/im', '');
  12.  
  13. // Compile:
  14. // if $cond
  15. //
  16. // into:
  17. // if ($cond) {
  18. $data = preg_replace('/if (.*)/im', 'if ($1) {', $data);
  19.  
  20. return $data;
  21.  
  22. }
  23.  
  24. echo compile('if value == 1');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement