Question

I've been given a school project which involves creating an online invoicing system in PHP. My teacher seems to be convinced that the only way to have a menu (with fixed pages like "display", etc) is to use case statements. My first guess would have been to just use a function which echo's some hrefs.

He also keeps saying that PHP is event driven. Is this true? I was always thought the interpreter on the server went through the code and then sent the html to the browser.

Any ideas?

Was it helpful?

Solution

PHP isn't event driven at all. Altho it exists Photon that is a framework to achive that.
And there are multiple ways to have menu. If with case you mean switch ... case: the answer is no. It is not the only way.

The way I make menu is with an array

$menu = array(
   'url 1'=>'Element 1 ',
   'url 2'=>'Element 2 ',
   'url 3'=>'Element 3 ' 
);

With this array knowing which is the element selected is pretty simple with no need of a case statement

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top