3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum ReturnValueType { case NumRows; case GetAffectedRows; case GetLastInsertedId; // Instead of just "null" use a more specific value case Nothing; } function runQuery($query, $values = NULL, ReturnValueType $returnValue = ReturnValueType::Nothing) { $ret = match($returnValue){ //query will run here and return the number of rows that are selected ReturnValueType::NumRows => 'Something', //query will run here and return the number of affected rows (for example to check if a create, update or delete is succesfull) ReturnValueType::GetAffectedRows => 'Something else', // query will run and return the ID of the inserted row ReturnValueType::GetLastInsertedId => 'Something else again', // query will execute without any returns ReturnValueType::Nothing => ReturnValueType::Nothing, }; if($ret !== ReturnValueType::Nothing){ return $ret; } } runQuery('', '');
Output for git.master, git.master_jit

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:
68.08 ms | 405 KiB | 5 Q