Skip to content

Instantly share code, notes, and snippets.

@gabrieljmj
Last active December 30, 2015 21:25
Show Gist options
  • Save gabrieljmj/686f41aeaf99516d3b83 to your computer and use it in GitHub Desktop.
Save gabrieljmj/686f41aeaf99516d3b83 to your computer and use it in GitHub Desktop.
PHP OO
<?php
class PhpOo
{
public function __call($name, array $args)
{
$cUFA = $this->getName('callUserFuncArray');
return $cUFA($this->getName($name), $args);
}
private function getName($name)
{
foreach (str_split($name) as $l) {
if (ctype_upper($l)) {
$name = str_replace($l, '_' . strtolower($l), $name);
}
}
return $name;
}
}
echo (new PhpOo)->callUserFuncArray('strlen', ['Hello']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment