Looking for an elegant approach in PHP to take in a variable and then output two preset values.
Instead of using a series of if statements like below, wondering if there is a more elegant solution.
Example:
if ($edit_array[1] == job) {
$table = 'jobs'; $id = 'job_id';
}
If you have a bunch of ifs/elseifs try replacing them with switch
or sometimes a simple “config” array works