#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Location
    Cleveland area
    Posts
    0
    Rep Power
    0
    I was wondering if it is possible to check if the beginning of a string starts with a certain other way. For example:: searching http://slashdot.org for http:// should return true, but searching shttp:// for http:// should return false. Thanks in advance.
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,640
    Rep Power
    4476
    $string = "http://www.slashdot.org";

    if (substr($string,0,7) == "http://")
    {
    echo "String starts with <A HREF="http://";" TARGET=_blank>http://";</A>
    }

    Look in the manual for more on substr

    ---John Holmes...

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions... *
    * *
    * PHP Manual. www.php.net/manual *
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter *
    *************************************************************

Similar Threads

  1. Codepupil
    By Adachic in forum C Programming
    Replies: 3
    Last Post: February 6th, 2004, 06:50 PM
  2. array explode ( string separator, string string [, int limit])
    By beemee_freeserv in forum HTML Programming
    Replies: 4
    Last Post: February 5th, 2004, 10:56 AM
  3. mgetty+sendfax on RH9
    By ayrin in forum Linux Help
    Replies: 0
    Last Post: January 31st, 2004, 02:11 AM
  4. Form validation: how do i check string length and type?
    By adamay in forum HTML Programming
    Replies: 3
    Last Post: January 13th, 2004, 10:21 AM
  5. Replies: 28
    Last Post: January 4th, 2004, 01:28 PM

IMN logo majestic logo threadwatch logo seochat tools logo