3v4l.org

run code in 300+ PHP versions simultaneously
<?php // DBLogger.php class DBLogger { private $enabled; private $operations; private $ignoredTables; public function __construct() { $this->enabled = false; $this->operations = null; $this->ignoredTables = null; } public function enable() { $this->enabled = true; return $this; } public function disable() { $this->enabled = false; return $this; } public function operations($operations) { $this->operations = $operations; return $this; } public function ignoreTables($tables) { $this->ignoredTables = $tables; return $this; } public function log($query) { if(!$this->enabled) return; $queryParts = explode(" ", $query); $queryCommand = $queryParts[0]; if($this->operations === null || strripos($this->operations, $queryCommand) !== false) { $tables = $this->ignoredTables === null ? array() : explode(",", $this->ignoredTables); $numOfTables = count($tables); for($i=0; $i<$numOfTables; $i++) { $tableName = str_replace(" ", "", $tables[$i]); if(strpos($query, $tableName) !== false) { return; } } $file = "queries_".date("Y-d-m").".sql"; $this->writeToFile($file, $query); } return $this; } private function writeToFile($file, $query) { $dir = dirname(__FILE__)."/logs/"; $content = ''; if(file_exists($dir.$file)) { $content = file_get_contents($dir.$file)."\n\n"; } $content .= $query.";"; file_put_contents($dir.$file, $content); } } global $dblogger; $dblogger = new DBLogger();
Output for git.master, git.master_jit, rfc.property-hooks

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