fork(3) download
  1. <?php
  2. class Test {
  3. public function Test1(int $number, string $str) { }
  4. }
  5.  
  6. //get the information about a specific method.
  7. $rm = new ReflectionMethod('Test', 'Test1');
  8.  
  9. //get all parameter names and parameter types of the method.
  10. foreach ($rm->getParameters() as $parameter) {
  11. echo 'Name: '.$parameter->getName().' - Type: '.$parameter->getType()."\n";
  12. }
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
Name: number - Type: int
Name: str - Type: string