I have a problem in PHP String Function. PLZ try to reply !!

Discussion in 'PHP' started by B R Bhatt, Apr 11, 2007.

  1. #1
    any body can help to solve my problem, which is related to PHP String function.

    Suppose:
    description is a variable which contain following information

    $description= "Since its creation in 2000, phpBB has become the most widely used Open Source forum solution. Like its predecessors, phpBB 3.0 “Olympus” has an easy to use administration panel and a user friendly installation process, which allows you to have a forum set up in minutes.";

    now how I can retrieve only 20 character with space to another variable, like

    $title="Since its creation in";

    please try to provide solution with scripts.
    I am waiting for reply !!!!!!!!
     
    B R Bhatt, Apr 11, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    $title = substr($description, 0, 20);
    
    PHP:
     
    nico_swd, Apr 11, 2007 IP
    commandos likes this.
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    $description= "Since its creation in 2000, phpBB has become the most widely used Open Source forum solution. Like its predecessors, phpBB 3.0 “Olympus” has an easy to use administration panel and a user friendly installation process, which allows you to have a forum set up in minutes.";

    This will not work. You need to escape the quotes around \“Olympus\”.

    Peace,
     
    Barti1987, Apr 11, 2007 IP
  4. B R Bhatt

    B R Bhatt Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks nico_swd for your help .
    I solved my problem...
    very very thanks again....
     
    B R Bhatt, Apr 11, 2007 IP