Skip to content

Instantly share code, notes, and snippets.

@wingsuitist
Last active September 24, 2015 13:02
Show Gist options
  • Save wingsuitist/2dc27138909dfc9c84e4 to your computer and use it in GitHub Desktop.
Save wingsuitist/2dc27138909dfc9c84e4 to your computer and use it in GitHub Desktop.
nice example of magic _call method in php
<?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