#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Sydney, NSW, Australia
    Posts
    40
    Rep Power
    15
    Hi,

    If I had

    $this = "Testing Testing 123";

    and i wanted to get the first 4 chars from it, what function do I use? I remember there is a function somewhere that does this, can't find it though.

    ------------------
    Michael Bray http://www.webhostarea.com

    [This message has been edited by Michael_Bray (edited October 20, 2000).]
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,645
    Rep Power
    4492
    $first4 = substr($this,0,4);

    ---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. 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
  2. finding certain characters in a string
    By ninjured in forum PHP Development
    Replies: 6
    Last Post: December 12th, 2003, 08:19 AM
  3. Search string, but only first characters
    By Optimum in forum PHP Development
    Replies: 3
    Last Post: November 22nd, 2003, 09:16 PM
  4. Advice on reversing order of characters within a string?
    By FriscoKid in forum C Programming
    Replies: 5
    Last Post: November 13th, 2003, 08:13 AM
  5. How to eliminate all characters except slash in a string?
    By murugesan in forum PHP Development
    Replies: 2
    Last Post: November 5th, 2003, 01:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo