I use this example below to ask how to pass an array into a Switch instead of listing them all out like this?
Perhaps if I had an array being fetched from a database for all the ‘pages’ as page.
I figured this method wasn’t the most elegant approach.
switch($_GET['page'])
{
case 'home':
include('home.php');
break;
case 'oem-customers':
include('oem-customers.php');
break;
case 'job-shop':
include('job-shop.php');
break;
case 'anodized-magnet-coils':
include('anodized-magnet-coils.php');
break;
case 'design':
include('design.php');
break;
case 'services':
include('services.php');
break;
case 'black-foil':
include('black-foil.php');
break;
case 'contact':
include('contact.php');
break;
case 'order';
include('order.php');
break;
default:
include('home.php');
}
How about