3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { function callable_equals(callable ...$callables){ $normalizeCallable = function(callable $callable){ if(is_string($callable)){ $callable = strtolower($callable); $pieces = explode("::", $callable); if(count($pieces) == 2){ return [$pieces[0], $pieces[1]]; } return $callable; } if(is_string($callable[0])){ $callable[0] = strtolower($callable[0]); } $callable[1] = strtolower($callable[1]); return $callable; }; foreach($callables as $i => $callable) $callables[$i] = $normalizeCallable($callable); var_dump($a, $b); return $a === $b; } class Foo{static function bar(){}} } namespace A\b\C\d { class Foo{static function bar(){}} } namespace { var_dump(callable_equals( ['Foo', 'bar'], 'foo::BAR' )); var_dump(callable_equals( ['A\\b\\C\\d\\Foo', 'bAr'], 'a\\B\\c\\D\\FoO::bar' )); }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $a in /in/n6Nct on line 25 Warning: Undefined variable $b in /in/n6Nct on line 25 NULL NULL Warning: Undefined variable $a in /in/n6Nct on line 26 Warning: Undefined variable $b in /in/n6Nct on line 26 bool(true) Warning: Undefined variable $a in /in/n6Nct on line 25 Warning: Undefined variable $b in /in/n6Nct on line 25 NULL NULL Warning: Undefined variable $a in /in/n6Nct on line 26 Warning: Undefined variable $b in /in/n6Nct on line 26 bool(true)

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:
40.97 ms | 402 KiB | 8 Q