3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stringCheck_TypeSafe(string $string) { $pos = strpos($string, 'cat'); if ($pos === 0) { return true; } return false; } function stringCheck_NotTypeSafe($string) { $pos = strpos($string, 'cat'); if ($pos != 'true') { return true; } return false; } echo "type safe string check, return should be true:\n"; var_dump(stringCheck_TypeSafe('cat')); echo "not type safe string check, return should be true:\n"; var_dump(stringCheck_NotTypeSafe('cat')); echo "not type safe string check, return should be false:\n"; var_dump(stringCheck_NotTypeSafe('a'));
Output for git.master, git.master_jit, rfc.property-hooks
type safe string check, return should be true: bool(true) not type safe string check, return should be true: bool(true) not type safe string check, return should be false: 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:
61.29 ms | 401 KiB | 8 Q