Home Php variable visibility
Reply: 0

Php variable visibility

Сергей Иванов
Сергей Иванов Published in 2018-02-11 13:39:19Z

I have a Class for render views

class View {
    function render(){}

And another one for routing

$router->get("/", function(){})

I need to call render() function inside the router callback function, but when $view = new View defined outside, it doesnt work, and variable invisible inside the body of the callback function. Only when $view defined in body itself. If function render() written without class it also work. Any suggestions?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.296483 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO