1

Gooda day guys) Hope you are well this october Saturday...

Learning Routes topic for custom CMS on php now.
And get next code, that do not understand..
So we have function Routes(), that return method for Controller, if it was send.

enter image description here And Next line misconfused me( we call "$this->routes" but right after it, we type in brackets "[strtoupper(method)][pattern]"
Guys what does it mean?

Moreover in previous video we have array property $routes.
He was adding the routes in that way
enter image description here

Can you please help, when author write $this->routes[strtoupper(method)][pattern] we are using here routes as Array?
If its array so how can you assign 2 values here? I mean [method] and [pattern]?

goodjobman
  • 68
  • 1
  • 7
  • https://stackoverflow.com/questions/16308252/php-add-elements-to-multidimensional-array-with-array-push – ADyson Oct 02 '21 at 07:29

1 Answers1

3

It is a multidimensional array. example below:

$name = 'john doe';

$array = [
   'firstLevel' => [
      'secondLevel' => [
          'thirdLevel' => $name
       ]
    ]
];

If i get value 'john doe' write

$array['firstLevel']['secondLevel']['thirdLevel'].
ADyson
  • 57,178
  • 14
  • 51
  • 63
JC Cavalca
  • 146
  • 8