3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); echo setlocale(LC_ALL, 0)."\n"; // echo setlocale(LC_ALL, "en_GB.UTF-8")."\n"; $terms = array ( //Always matches: "Label Generation", //Doesn't match when using u (PCRE_UTF8) modifier: "Receipt of Prescription and Validation of Patient Information", ); $text = "Some terms to match: ".implode(", ",$terms); $pattern = "/(".implode(")|(", $terms).")/is"; $regexps = array ( "Unicode" => $pattern."u", //Add u (PCRE_UTF8) modifier "Non-unicode" => $pattern ); echo "Text:\n'$text'\n"; foreach($regexps as $type=>$regexp) { $matches = array(); $total = preg_match_all($regexp,$text,$matches); echo "\n\n"; echo "$type regex:\n'$regexp'\n\n"; echo "Total $type matches: "; var_dump($total); echo "\n$type matches: "; var_dump($matches[0]); } ?>
Output for git.master, git.master_jit, rfc.property-hooks
C Text: 'Some terms to match: Label Generation, Receipt of Prescription and Validation of Patient Information' Unicode regex: '/(Label Generation)|(Receipt of Prescription and Validation of Patient Information)/isu' Total Unicode matches: int(2) Unicode matches: array(2) { [0]=> string(16) "Label Generation" [1]=> string(61) "Receipt of Prescription and Validation of Patient Information" } Non-unicode regex: '/(Label Generation)|(Receipt of Prescription and Validation of Patient Information)/is' Total Non-unicode matches: int(2) Non-unicode matches: array(2) { [0]=> string(16) "Label Generation" [1]=> string(61) "Receipt of Prescription and Validation of Patient Information" }

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.5 ms | 402 KiB | 8 Q