How to pass parameters dynamically in PHP?
- by user198729
I need to pass the $route to its inner function,but failed:
function compilePath( $route )
{
preg_replace( '$:([a-z]+)$i', 'pathOption' , $route['path'] );
function pathOption($matches)
{
global $route;//fail to get the $route
}
}
I'm using php5.3,is there some feature that can help?