Skip to content

Instantly share code, notes, and snippets.

@Shaked
Created October 14, 2018 10:55
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 Shaked/11fd39eb81f87e281c0b13482405abb8 to your computer and use it in GitHub Desktop.
Save Shaked/11fd39eb81f87e281c0b13482405abb8 to your computer and use it in GitHub Desktop.
<?php
class A {
/**
* @param $args
*/
public function methodIsCool($args) {
var_dump($args);
}
}
$userRequest = $_GET['userRequest'] ?? null;
$method = $userRequest . 'IsCool';
$args = [];
$a = new A();
if (method_exists($a, $method)) {
$a->$method($args);
} else {
var_dump('err: ' . $method);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment