Last active
September 24, 2015 13:02
-
-
Save wingsuitist/2dc27138909dfc9c84e4 to your computer and use it in GitHub Desktop.
nice example of magic _call method in php
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 | |
class theShell{ | |
public function __call($command, $arguments) { | |
exec($command.' '.implode(' ', $arguments), $out, $returnCode); | |
echo implode("\n", $out); | |
return $returnCode; | |
} | |
} | |
// get all commands as nice methods | |
$myShell = new theShell(); | |
$myShell->ls('-l'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment