3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Outside of the application, e.g. DB or some storage. function addSomeIntegerFieldToDB($value) { $sql = 'INSERT INTO mytable (integer_field) VALUES (:int)'; // $st = $pdo->prepare($sql); // $st->execute(array('int' => $value); } // the application: global $conditional; $conditional = true; class X { public function doSmth($id) { // Assertion will run independently of $conditional, thus preventing a wrong $id to be passed to ->doSmth() method assert(is_int($id), \Exception('wot ar y doin')); global $conditional; if ($conditional) { addSomeIntegerFieldToDB($id); } } } $obj = new X; $obj->doSmth(13);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function Exception() in /in/smYKU:20 Stack trace: #0 /in/smYKU(33): X->doSmth(13) #1 {main} thrown in /in/smYKU on line 20
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:
50.77 ms | 401 KiB | 8 Q