Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save diloabininyeri/a3ee60ad70dbde9467e6f619a97ceac2 to your computer and use it in GitHub Desktop.
Save diloabininyeri/a3ee60ad70dbde9467e6f619a97ceac2 to your computer and use it in GitHub Desktop.
<?php
error_reporting(E_STRICT | E_ALL);
ini_set('display_errors', 1);
$file = file_get_contents("deneme.blade.php");
function e($par)
{
return $par;
}
$a = preg_replace_callback('/{{(.*)}}/sU', static function ($find) {
return '<?php echo ' . e($find[1]) . ';?>';
}, $file);
$b = preg_replace_callback('/@for(.*)/', function ($f) {
return '<?php for' . $f[1] . ' :?>';
}, $a);
$c = preg_replace_callback('/@endfor/', function ($f) {
return '<?php endfor; ?>';
}, $b);
$d = preg_replace_callback('/@if(.*)/', function ($f) {
return '<?php if' . $f[1] . ':?>';
}, $c);
$e = preg_replace_callback('/@endif/', function () {
return '<?php endif;?>';
}, $d);
$f = preg_replace_callback('/@php/', function ($a) {
return '<?php ';
}, $e);
$g = preg_replace_callback('/@endphp/', function ($a) {
return '; ?>';
}, $f);
$r=str_replace("\n\n","",$g);
file_put_contents('vv.php', $r);
include_once "vv.php";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment