3v4l.org

run code in 300+ PHP versions simultaneously
<?php $trim = function($str) { return preg_replace('~\(+(\(((?:[^()]*|(?1))*)\))\)+|(\((?:[^()]*|\g{-1})*\))~', '$2$3', $str); }; echo $trim('((((A))))'), "\n"; echo $trim('(((((B+C)*A)*(F))))'), "\n"; echo $trim('(A+B)(B+C)'), "\n"; echo $trim('(((((B+C)*A))))'), "\n"; echo str_repeat('-',15), PHP_EOL; echo $trim('((A+B)+C)'), "\n"; echo $trim('(((A+B))+C)'), "\n"; echo $trim('((((A+B))+C))'), "\n"; echo $trim('(A+(B+C))'), "\n"; echo $trim('(A+((B+C)))'), "\n";
Output for git.master, git.master_jit, rfc.property-hooks
A ((B+C)*A)*(F) (A+B)(B+C) (B+C)*A --------------- ((A+B)+C) A+B+C) A+B+C)) (A+(B+C)) (A+B+C

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:
50.8 ms | 401 KiB | 8 Q