3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo1($string, $with) { if (!$bytes = strlen($with)) { return true; } // Warning check, see http://php.net/manual/en/function.substr-compare.php#refsect1-function.substr-compare-returnvalues if (strlen($string) < $bytes) { return false; } return substr_compare($string, $with, -$bytes); } function foo2($string, $with) { if (!$bytes = strlen($with)) { return true; } // Warning check, see http://php.net/manual/en/function.substr-compare.php#refsect1-function.substr-compare-returnvalues if (strlen($string) < $bytes) { return false; } return substr_compare($string, $with, -$bytes, $bytes); } var_dump(foo1('a', 'a')); var_dump(foo2('a', 'a')); var_dump(foo1('', '')); var_dump(foo2('', '')); var_dump(foo1('a', '')); var_dump(foo2('a', '')); var_dump(foo1('', 'a')); var_dump(foo2('', 'a'));
Output for git.master, git.master_jit, rfc.property-hooks
int(0) int(0) bool(true) bool(true) bool(true) bool(true) bool(false) bool(false)

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:
43.66 ms | 401 KiB | 8 Q