3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Test; function is_string($str) { return false; } /** * @throws \ReflectionException */ function getReflectionFunction(string $functionName): \ReflectionFunction { $qualifiedFunctionName = strpos($functionName, '\\') === false ? __NAMESPACE__ . '\\' . $functionName : $functionName; try { return new \ReflectionFunction($qualifiedFunctionName); } catch (\ReflectionException $e) { return new \ReflectionFunction($functionName); } } var_dump(getReflectionFunction('is_string')->inNamespace()); // true var_dump(getReflectionFunction('is_string')->getNamespaceName()); // 'Test' var_dump(getReflectionFunction('\\is_string')->inNamespace()); // false var_dump(getReflectionFunction('\\is_string')->getNamespaceName()); // ''
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) string(4) "Test" bool(false) string(0) ""

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:
33.82 ms | 1497 KiB | 4 Q