3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = "50+60"; $regex = '#(?<val1>.*)(?<operator>[\+\-\/\*])(?<val2>.*)#'; preg_match( $regex, $x, $match); if (count($match)) { echo $match['val1'] . $match['operator'] . $match['val2'] .' = '; switch ($match['operator']) { case '+': $result = $match['val1'] + $match['val2']; break; case '-': $result = $match['val1'] - $match['val2']; break; case '/': $result = $match['val1'] / $match['val2']; break; case '*': $result = $match['val1'] * $match['val2']; break; } echo $result; }
Output for git.master_jit, git.master, rfc.property-hooks
50+60 = 110

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