3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PassphraseException extends Exception {} class PassphraseTooShortException extends PassphraseException {} class PassphraseTooLongException extends PassphraseException {} class PassphraseRequiresLetterException extends PassphraseException {} class PassphraseRequiresNumberOrSpecialException extends PassphraseException {} class Passphrase { static function validate($passphrase) { $len = strlen($passphrase); if ($len < 15) { throw new PassphraseTooShortException('Jesus fucking christ, read the requirements you fuck!'); } if ($len > 140) { throw new PassphraseTooLongException('Are you fucking kidding me? How are you going to remember this shit...'); } $no_alpha = str_replace(str_split('abcdefghijklmnopqrstuvwxyz'), '', strtolower($passphrase)); if ($no_alpha === $passphrase) { throw new PassphraseRequiresLetterException('Fucking idiot.'); } if ($no_alpha === '') { throw new PassphraseRequiresNumberOrSpecialException('You fucking fuck, fuck you fucking fucker fuckface fuck.'); } } static function isValid($passphrase) { try { static::validate($passphrase); } catch (PassphraseException $e) { return false; } return true; } } var_dump(Passphrase::isValid('qt3point141592653589793238'));
Output for git.master, git.master_jit, rfc.property-hooks
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:
37.67 ms | 401 KiB | 8 Q