code: public function hasUrl($string)
      {
          $result = false;
          $words = $this->getWords($string);
  
          foreach ($words as $word) {
              if (preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $word)) {
                  $result = true;
              }
          }
  
          return $result;
      }
docs: Checks if string has a url.
  
  @param string $string
  
  @return bool