3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $expr = '#^v?(?P<major>[0-9]+)\.(?P<minor>[0-9]+)(?:\.(?P<release>[0-9]+))?$#'; $val = 'v12.0'; preg_match($expr, $val, $match); var_dump($match);
based on JPLoD
Output for 4.3.3 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(5) { [0]=> string(5) "v12.0" ["major"]=> string(2) "12" [1]=> string(2) "12" ["minor"]=> string(1) "0" [2]=> string(1) "0" }
Output for 4.3.0 - 4.3.2
array(3) { [0]=> string(5) "v12.0" [1]=> string(2) "12" [2]=> string(1) "0" }