How to understand this piece of code is in php?
$this->routes = include($routesPath);
How to understand this? It's a line from the Route class
Can't understand the variable routes is assigned a value routesPath using include?
July 2nd 19 at 16:53
Can't set background for id="top-menu" what could be wrong?
The better to monitor the ip cameras and NAS-s?
How to run a jquery function when you change any element in the form of different types?
The highest quality service translation online Russian-English, for free?
The best option exaggeration of the landing page on WP?
Why VK API asks for a captcha?
How to implement fill-in svg, when focusing on input's e?
Django how to disable the automatic creation of permissions?
More answers about
"How to understand this piece of code is in php?"
July 2nd 19 at 16:55
In the variable $routesPath contains the name of the file (apparently) with an array of routes. In fact, it is assigning a value to a variable, the contents of which are contained in a separate file.
July 2nd 19 at 16:57
in the file on the path $routesPath
will be the type code
<?php return array( 'abc' =--> 123 ... );
in $this->routes will be placed in this array
July 2nd 19 at 16:59
include returns TRUE/FALSE (and error) depending on the success of the connection of the specified file. in $this->routes will be appropriate Boolean value.
In General, the decision unsuccessfully. I would use the test is_file().
commented on July 2nd 19 at 17:02
: what version of PHP no? Different versions include() behave differently.
commented on July 2nd 19 at 17:05
in this case, it is obvious that the file returned array as said . why to a variable with the same name to put the info about the success of some of the inclusions. moreover, under any circumstances, and the architecture it may not be included? when the developer is not sure if he has a file in the system or what?
commented on July 2nd 19 at 17:08
: file array is not returned. The function returns a value. A question to the documentation, or simply experiment. Try.
commented on July 2nd 19 at 17:11
: you are currently defending your answer?
commented on July 2nd 19 at 17:14
Find more questions by tags