Last active
December 30, 2015 21:25
-
-
Save gabrieljmj/686f41aeaf99516d3b83 to your computer and use it in GitHub Desktop.
PHP OO
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 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