I’m wondering if it’s possible to replicate:
if ($a = 1) {
header('Location: http://google.com');
exit;
} else {
header('Location http://yahoo.com');
exit;
}
Using short hand? Maybe…
$a = 1 ? header('Location: http://google.com') : header('Location http://yahoo.com');
exit;
This does not seem to work, meaning I’m always redirected to google. =(
Try this:
Note that
$a = 1is an assignment and will always evaluate totrue. You need==to achieve comparison.