codequirks
Programmer
Hi there
I am relatively new to php finding it a powerful and useful language, quick question about the include statement. Can I use it to include some generic code within the middle of a php function? Several of my pages access the same switch statement with a small set of core data in it. To save me changing it in each page is there an easy way to include this?? Thanks in advance, code below.
Both library.php, viewer.php and index.php have the following switch statement in various functions - this switch statement is not dynamic but is generic.
switch ($filmID)
{
case 1:
$filmTitle = "Some Film Title";
$filmFile = "zebra.avi";
$filmRating = 3;
break;
case 2:
$filmTitle = "Another Film Title";
$filmFile = "giraffe.avi";
$filmRating = 7;
break;
case 3:
$filmTitle = "And another Film";
$filmFile = "monkey.avi";
$filmRating = 5;
break;
}
Thanks