3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculate_string( $mathString ) { $mathString = trim($mathString); // trim white spaces $mathString = preg_replace('#[^0-9\+\-\*\/\(\) ]#', '', $mathString); // remove any non-numbers chars; exception for math operators var_dump($mathString); $compute = create_function("", "return (" . $mathString . ");" ); return 0 + $compute(); } $string = " 4141.58-3878.96-262.62"; echo calculate_string($string); // outputs 8
Output for git.master, git.master_jit, rfc.property-hooks
string(19) "414158-387896-26262" Fatal error: Uncaught Error: Call to undefined function create_function() in /in/PNo2h:6 Stack trace: #0 /in/PNo2h(11): calculate_string('414158-387896-2...') #1 {main} thrown in /in/PNo2h on line 6
Process exited with code 255.

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