3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: "integer" will be interpreted as a class name. Did you mean "int"? Write "\integer" to suppress this warning in /in/49s1p on line 2 array|string|null preg_replace [array|string pattern; array|string replacement; array|string subject; int [limit]; [count]; ] {closure} [integer param1; ] {closure} [string param1; ]

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
77.8 ms | 402 KiB | 8 Q