3v4l.org

run code in 300+ PHP versions simultaneously
<?php function FormatSql($query, array $params = []) { $patt = '~ ([\'"`]) # capture this quote character (?:\\\\.|(?!\1).)* # any escaped character, or # any character that isn\'t the captured one \1 # the captured quote again (*SKIP)(*FAIL) # ignore this | \?\?? # one or two question marks | ::?\w+ # word characters marked with one or two colons~x'; return preg_replace_callback($patt, function ($matches) use (&$params) { if(!isset($matches[1])) return $matches[0]; switch($matches[1]) { case '?': if(!$params) throw new \DomainException("Not enough params"); return '*snip*'; case '??': if(!$params) throw new \DomainException("Not enough params"); return '*snip*'; case ':': if(!array_key_exists($matches[2], $params)) throw new \DomainException("\"$matches[2]\" param not provided"); return '*snip*'; case '::': if(!array_key_exists($matches[2], $params)) throw new \DomainException("\"$matches[2]\" param not provided"); return '*snip*'; } throw new \Exception("Bad regex"); }, $query); } $bigStr = str_repeat('x', 443000); $bigQuery = "INSERT INTO `emr_doc_file` (`emr_doc_id`, `edf_file`, `edf_mimetype`, `edf_upload_date`) VALUES ('108', x'$bigStr', 'application/pdf', 1490978009)"; $result = FormatSql($bigQuery, []); if($result === null) { throw new \Exception("preg error: " . preg_last_error() . "\nsee: http://php.net/manual/en/pcre.constants.php#117743"); } echo substr($result,0,100).PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Exception: preg error: 6 see: http://php.net/manual/en/pcre.constants.php#117743 in /in/GdtmP:38 Stack trace: #0 {main} thrown in /in/GdtmP on line 38
Process exited with code 255.

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:
120.19 ms | 405 KiB | 5 Q