I donโt have a specific problem, I just want to deepen my understanding of what is happening with Silex and some new PHP features in general. This is based on code examples on the "use" page of the Silex documentation:
$blogPosts = array(
1 => array(
'date' => '2011-03-29',
'author' => 'igorw',
'title' => 'Using Silex',
'body' => '...', );
$app->get('/blog/{id}', function (Silex\Application $app, $id) use ($blogPosts) {
}
Questions
What is the difference between passing $appand $idas parameters for a function, and use - for a variable$blogPosts
Can it $blogPostsalso be passed as a parameter to a function?
- In addition, I often see
use ($app). What is the difference between using -ing $appand passing it as a parameter?