3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/(?<qty>\d+)x(?<name>[^[]+)\[(?<price>[^]]+)\]=\[(?<subtotal>[^]]+)\]/'; $str = '2xMUA Matte Lipstick - Totally Nude[300]=[600]'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); var_dump($matches); echo $matches[0]["qty"] . PHP_EOL; echo $matches[0]["name"] . PHP_EOL; echo $matches[0]["price"] . PHP_EOL; echo $matches[0]["subtotal"] . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [0]=> array(9) { [0]=> string(46) "2xMUA Matte Lipstick - Totally Nude[300]=[600]" ["qty"]=> string(1) "2" [1]=> string(1) "2" ["name"]=> string(33) "MUA Matte Lipstick - Totally Nude" [2]=> string(33) "MUA Matte Lipstick - Totally Nude" ["price"]=> string(3) "300" [3]=> string(3) "300" ["subtotal"]=> string(3) "600" [4]=> string(3) "600" } } 2 MUA Matte Lipstick - Totally Nude 300 600

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:
32.81 ms | 402 KiB | 8 Q