3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = " /\[ (?:block:(?<block>piechart)) (?: (?:\s+value:(?<value>[0-9]+)) | (?:\s+stroke:(?<stroke>[0-9]+)) | (?:\s+angle:(?<angle>[0-9]+)) | (?:\s+colorset:(?<colorset>reds|yellows|blues)) )* \]/xumi"; $subject = "here is a block to be replaced [block:piechart value:25 angle:0] [block] and another one [block:piechart colorset:reds value:20]"; preg_replace_callback($pattern, 'callbackFunction', $subject, -1, $count, PREG_UNMATCHED_AS_NULL); function callbackFunction($matches) { var_dump(array_filter($matches, function ($v) { return !is_null($v); })); // process matched values, return some replacement... $replacement = "..."; return $replacement; };
Output for git.master, git.master_jit, rfc.property-hooks
array(7) { [0]=> string(35) "[block:piechart value:25 angle:0]" ["block"]=> string(8) "piechart" [1]=> string(8) "piechart" ["value"]=> string(2) "25" [2]=> string(2) "25" ["angle"]=> string(1) "0" [4]=> string(1) "0" } array(7) { [0]=> string(39) "[block:piechart colorset:reds value:20]" ["block"]=> string(8) "piechart" [1]=> string(8) "piechart" ["value"]=> string(2) "20" [2]=> string(2) "20" ["colorset"]=> string(4) "reds" [5]=> string(4) "reds" }

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:
98.88 ms | 407 KiB | 5 Q