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('/(\d+(?:\.\d+)?)(\s*[€%])/i', function($matches) use ($levelamt){ return number_format(round(($matches[1] * $levelamt), 2), 2).$matches[2]; }, $string); echo $description;
Output for git.master, git.master_jit, rfc.property-hooks
description: test1: 7.50 €, test2: 5.63 €, test3: 18.75%, test4: 22.50%

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:
176.36 ms | 405 KiB | 5 Q