Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 1.00 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. function($url)
  4. {
  5.   $matches = array();
  6.  
  7.   if(isset($url[0]) && $url[0] == "/")
  8.   {
  9.     if(isset($url[1]) && $url[1] == "u")
  10.     {
  11.       if(isset($url[2]) && $url[2] == "s" && isset($url[3]) && $url[3] == "e" && isset($url[4]) && $url[4] == "r")
  12.       {
  13.         if(preg_match('/\\/user(?:\\/(?<id>\\d+))?/', $url, $matches))
  14.         {
  15.           return array(array(2), $matches);
  16.         }
  17.         if(isset($url[5]) && $url[5] == "-")
  18.         {
  19.           if(isset($url[6]) && $url[6] == "p" && isset($url[7]) && $url[7] == "r" && isset($url[8]) && $url[8] == "o" && isset($url[9]) && $url[9] == "f" && isset($url[10]) && $url[10] == "i" && isset($url[11]) && $url[11] == "l" && isset($url[12]) && $url[12] == "e" && isset($url[13]) && $url[13] == "/" && preg_match('/\\/user\\-profile\\/(\\d+)/', $url, $matches))
  20.           {
  21.             return array(array(3), $matches);
  22.           }
  23.         }
  24.         return array(array(1), $matches);
  25.       }
  26.     }
  27.     return array(array(0), $matches);
  28.   }
  29.  
  30.   return false;
  31. }