URL Routing in PHP

leechit

New Member
I'm doing a router, well with routes, part of my learning and wanted to see if my approach worked. Yet this been bothering me recently, see right now I'm adding the routes in an array, then adding them to a main "manager". So I got (pseudo sample) to this approach \[code\]<?php $paths = array(); $paths[] = new routes_object('PATH', array( 'controller'=> 'controllerName', 'action' => 'actionName')); $router = new router_manager()->add($paths);\[/code\]After adding all the routes, means it would more than 10 or so. Then to see if they match I've to iterate through them and check the match() function to start the extract process to get variables. Is it okay to take this approach? Having a collection of objects in a array and iterating?
 
Back
Top