3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $closure1 = function(integer $param1) { return $param1 * 2; }; $closure2 = function(string $param1) { return mb_strlen($param1); }; foreach (['preg_replace', $closure1, $closure2] as &$func) { $reflection = new ReflectionFunction($func); if (version_compare(PHP_VERSION, '7.0.0') >= 0) { echo $reflection->getReturnType()." "; } echo $reflection->getName()." ["; foreach($reflection->getParameters() as &$param) { if ((version_compare(PHP_VERSION, '7.0.0') >= 0) and $param->hasType()) { echo $param->getType().($param->allowsNull() ? '|null' : '')." "; } echo ($param->isOptional() ? '[' : '').$param->getName().($param->isOptional() ? ']' : ''); echo "; "; } echo "]"; echo "\n\n\n"; } ?>
based on uufKo
Output for 7.0.0 - 7.2.6
preg_replace [regex; replace; subject; [limit]; [count]; ] {closure} [integer param1; ] {closure} [string param1; ]
Output for hhvm-3.15.4 - 3.17.3
HH\mixed preg_replace [HH\mixed|null pattern; HH\mixed|null replacement; HH\mixed|null subject; HH\int [limit]; ?HH\int|null [count]; ] {closure} [integer param1; ] {closure} [string param1; ]
Output for hhvm-3.12.14
HH\mixed preg_replace [HH\mixed|null pattern; HH\mixed|null replacement; HH\mixed|null subject; HH\int [limit]; ?HH\int|null [count]; ] {closure} [integer param1; ] {closure} [HH\string param1; ]
Output for 5.6.0 - 5.6.30
preg_replace [regex; replace; subject; [limit]; [count]; ] {closure} [param1; ] {closure} [param1; ]