As the title states, whats a more simple way to do
if ( $somevariable == $somearray[1] || $somevariable == $somearray[3] || $somevariable == $somearray[10] )
Seems like even with 3 variables.. there would be a shortcut.
I know this doesnt work, but something like would be nice:
if ($somevariable == $somearray[1],$somearray[3],$somearray[10]) {
One option
if ( in_array( $somevariable, array( $somearray[1], $somearray[3], $somearray[10] ) ) {}
You could use in_array.
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