3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newString = "he 800s."; $originalString = $newString; $regex = "/[$#]*(\d+(\.|\,|\s)?\d*(\.|\,|\s)?\d*){3,}[%.\)]*/"; preg_match_all($regex, $originalString, $matches); foreach($matches[0] as $match) { if ($match[0] == "$" || $match[0] == "#") { continue; } $stringLength = strlen($match); if ($match[$stringLength - 1] == "%" || $match[$stringLength - 1] == "." || $match[$stringLength - 1] == ")") { continue; } $replacement = ''; for ($i = 0; $i < strlen($match); $i++) { if ($match[$i] == '-' || $match[$i] == '+' || $match[$i] == ' ' || $match[$i] == '.' || $match[$i] == ',' || $match[$i] == '(' || $match[$i] == ')') { $replacement .= $match[$i]; } else { $replacement .= 'X'; } } $match = preg_quote($match); $newString = preg_replace("/" . $match . "/U", $replacement, $newString); } print_r("ORIGINAL STRING: " . $originalString . "\n"); print_r("FILTERED STRING: " . $newString . "\n"); print_r("MATCHES: \n"); print_r($matches);
Output for git.master_jit, git.master, rfc.property-hooks
ORIGINAL STRING: he 800s. FILTERED STRING: he XXXs. MATCHES: Array ( [0] => Array ( [0] => 800 ) [1] => Array ( [0] => 0 ) [2] => Array ( [0] => ) [3] => Array ( [0] => ) )

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:
56.61 ms | 402 KiB | 8 Q