3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Application\Router; use Application\Views as Views; class Router { private $request_uri; private $routes = array(); public function __construct($request_uri) { $this->request_uri = $request_uri; /** * Routes go here. * The URI is matched against the routes IN THE ORDER THEY ARE DEFINED! */ $this->addRoute('/\/?events\/?/'); $this->addRoute('/^\/$/'); } public function addRoute($regex) { $this->routes[] = $regex; } public function route() { $match = FALSE; for ($x = 0; $x < count($this->routes); $x ++) { if (preg_match($this->routes[$x], $this->request_uri)) { $match = TRUE; } } if ($match === FALSE) { new Views\FOF(); } else { $v = new Views\Events(); echo $v->blah; } } }
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.93 ms | 401 KiB | 8 Q