3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newString = "ds) Spend $200+ at AT&T Small Business Internet, get 20,000 Membership Rewards points, repeatable up to three times; or Spend $200+ at AT&T Small Business Wireless, get $200, re"; $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: ds) Spend $200+ at AT&T Small Business Internet, get 20,000 Membership Rewards points, repeatable up to three times; or Spend $200+ at AT&T Small Business Wireless, get $200, re FILTERED STRING: ds) Spend $200+ at AT&T Small Business Internet, get XX,XXX Membership Rewards points, repeatable up to three times; or Spend $200+ at AT&T Small Business Wireless, get $200, re MATCHES: Array ( [0] => Array ( [0] => $200 [1] => 20,000 [2] => $200 [3] => $200, ) [1] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0, ) [2] => Array ( [0] => [1] => [2] => [3] => , ) [3] => Array ( [0] => [1] => [2] => [3] => ) )

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:
34.13 ms | 403 KiB | 8 Q