
PHP Router in 140 Characters
This is a dimple(damn simple) URL routing script for PHP which is written in just 140 characters of code, so it fits within a tweet.
It’s NOT a good router at all, don’t use it in a real application, it’s not exception handled either. I did it just for fun and to demonstrate the simplicity.
So here’s the router code, and that’s all (seriously).
class R{
function a($r,callable $c){$this->r[$r]=$c;}
function e(){$s=$_SERVER;$i='PATH_INFO';$p=isset($s\[$i])?$s[$i]:'/';$this->r[$p\]();}
}









