1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php help

Discussion in 'PHP' started by kumar84, Aug 29, 2007.

  1. #1
    hi friends

    now iam having a string $string="i am a boy";

    if i pass $remove="boy" means it should remove boy from $string and it should display $string="i am a"
    now if i do echo $string means it should print i am a

    or

    like that if i pass $remove="i" means it should remove i from $string and it should display $string="am a boy"

    can any body help me in php
     
    kumar84, Aug 29, 2007 IP
  2. xemiterx

    xemiterx Peon

    Messages:
    62
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It looks like you should go to google.com and type in 'php tutorial' and do some reading.

    But to answer your question, if you have a string:
    $string="i am a boy";
    and:
    $remove="boy";

    Then you will have two strings:
    $string will be "i am a boy"
    $remove will be "boy"

    If you want to remove "boy" from inside of the string $string you can do this:
    $string = str_replace('boy', '', $string);
    PHP:
     
    xemiterx, Aug 29, 2007 IP