3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "description: test1: 10 €, test2: 7.50 €, test3: 25%, test4: 30%"; $levelamt = 0.75; $description = preg_replace_callback('/([0-9][.0-9]*)\s*(\s€|%)/i', function($matches) use ($levelamt){ return round(($matches[1] * $levelamt),2).$matches[2]; }, $string); echo $description;
Output for git.master, git.master_jit, rfc.property-hooks
description: test1: 7.5 €, test2: 5.63 €, test3: 18.75%, test4: 22.5%

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:
42.33 ms | 1939 KiB | 4 Q