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
3 answers
July 2nd 19 at 16:55
Solution
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
Solution
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().
no - albin.Block commented on July 2nd 19 at 17:02
: what version of PHP no? Different versions include() behave differently. - Assunta 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? - albin.Block 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. - Assunta commented on July 2nd 19 at 17:11
: you are currently defending your answer? - albin.Block commented on July 2nd 19 at 17:14

Find more questions by tags PHP