Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Forked from anonymous/hack.php
Last active December 16, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonewebdesign/5482572 to your computer and use it in GitHub Desktop.
Save simonewebdesign/5482572 to your computer and use it in GitHub Desktop.
I did it for teh lulz
<?php
class Foo {
public function bar() {
return "bar";
}
public static function baz() {
return "baz";
}
}
$code = '
$foo = new Foo();
echo $foo.bar(); # dots in PHP. Cool huh?
echo Foo::baz();
';
$newcode = str_replace(".", "->", $code);
eval($newcode); // barbaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment