Skip to content

Instantly share code, notes, and snippets.

@tlongren
Created June 27, 2013 16:03
Show Gist options
  • Select an option

  • Save tlongren/5877744 to your computer and use it in GitHub Desktop.

Select an option

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