Is there a shorter way of writing this (without using regex or string-matching functions)?
if($page=='page1.php' || $page=='page2.php' || $page=='page3.php' || $page=='page4.php'){ do something...} I'm looking for something like:
if($page==('page1.php', 'page2.php', 'page3.php', 'page4.php')){do something...} but I know that isn't correct. Any suggestions?
in_arraymust search through the array looking for a match (O(n)time complexity), while looking up a string as a key rather than a value takes a constant time to lookup (O(1)time complexity).