Is there a shorter way of writing this?
<?
if($_GET['id']==1 ||
$_GET['id']==3 ||
$_GET['id']==4 ||
$_GET['id']==5)
{echo 'does it really have to be this explicit?'};
?>
Something like this perhaps?
<?
if($_GET['id']==1 || 3 || 4 || 5){echo 'this is much shorter'};
?>
Just try with:
if ( in_array($_GET['id'], array(1, 3, 4, 5)) ) {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With