3v4l.org

run code in 300+ PHP versions simultaneously
<?php function splitOn($needle, $subject) { $needle = preg_quote($needle, '/'); $pattern = '/(?<!\x5c)(?:\x5c.)*\K' . $needle . '/s'; return preg_split($pattern, $subject); } $rules = 'trim:-,left|replace:[0-9]\|[\,a-z],3|int'; $rules = splitOn('|', $rules); $rules = array_map(function($rule) { [$rule, $arguments] = explode(':', $rule, 1); $arguments = splitOn(',', $arguments); return [$rule, $arguments]; }, $rules); var_dump($rules);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 1 in /in/MeEBk on line 13 Deprecated: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/MeEBk on line 5 Warning: Undefined array key 1 in /in/MeEBk on line 13 Deprecated: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/MeEBk on line 5 Warning: Undefined array key 1 in /in/MeEBk on line 13 Deprecated: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/MeEBk on line 5 array(3) { [0]=> array(2) { [0]=> string(11) "trim:-,left" [1]=> array(1) { [0]=> string(0) "" } } [1]=> array(2) { [0]=> string(24) "replace:[0-9]\|[\,a-z],3" [1]=> array(1) { [0]=> string(0) "" } } [2]=> array(2) { [0]=> string(3) "int" [1]=> array(1) { [0]=> string(0) "" } } }

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