3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyCalculator { private $_fval, $_sval; public function __construct( $fval, $sval ) { $this->_fval = $fval; $this->_sval = $sval; } public function add() { return $this->_fval + $this->_sval; } public function subtract() { return $this->_fval - $this->_sval; } public function multiply() { return $this->_fval * $this->_sval; } public function divide() { return $this->_fval / $this->_sval; } } $mycalc = new MyCalculator(12, 6); echo $mycalc-> add(); // Displays 18 echo '/n'; echo $mycalc-> multiply(); // Displays 72 echo $mycalc-> subtract(); // Displays 6 echo $mycalc-> divide(); // Displays 2 ?>
Output for git.master, git.master_jit, rfc.property-hooks
18/n7262

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