Skip to content

Instantly share code, notes, and snippets.

@tlongren
Created June 27, 2013 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlongren/5877744 to your computer and use it in GitHub Desktop.
Save tlongren/5877744 to your computer and use it in GitHub Desktop.
My favorite method for checking for the existence of a string in a variable
<?php
$status = (strpos($_SERVER['REQUEST_URI'],'my-page') ? 'active' : 'notactive');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment