3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newString = "Give cash back at the rate that WF Visa does. 100,000 points = $1,250. Plus they have better point value when it comes to hotels."; $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'; } } echo $replacement; $match = preg_quote($match); echo $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
XXX,XXX 100,000 ORIGINAL STRING: Give cash back at the rate that WF Visa does. 100,000 points = $1,250. Plus they have better point value when it comes to hotels. FILTERED STRING: Give cash back at the rate that WF Visa does. XXX,XXX points = $1,250. Plus they have better point value when it comes to hotels. MATCHES: Array ( [0] => Array ( [0] => 100,000 [1] => $1,250. ) [1] => Array ( [0] => 0 [1] => 0. ) [2] => Array ( [0] => [1] => . ) [3] => Array ( [0] => [1] => ) )

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