Рассмотрим на примерах с рефлексией:
Код:
function bubleGum(string $name = '', int $price = 0)
{
return true;
}
ReflectionFunction::export('bubleGum', false);
Выведет:
Function [ <user> function bubleGum ] { @@ index.php 11 — 14 — Parameters [2] { Parameter #0 [ <optional> string $name = » ] Parameter #1 [ <optional> integer $price = 0 ] } }
Код:
class One
{
public function __construct($a='',$b='',$c='',$d=''){}
public function foo($a='',$b='',$c=''){}
}
ReflectionMethod::export('One','foo',false);
Выведет:
Method [ <user> public method foo ] { @@ index.php 6 — 6 — Parameters [3] { Parameter #0 [ <optional> $a = » ] Parameter #1 [ <optional> $b = » ] Parameter #2 [ <optional> $c = » ] } }
Информация взята:
http://php.net/manual/ru/class.reflectionclass.php
http://us3.php.net/manual/ru/class.refl … nction.php
Протестировано:
https://www.runphponline.com