SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Oct 2007
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Easy] Please help what is the right replacement code

    I have a variable, lets say $peoplename, that have dynamic output

    for example

     bryant
    or

    michael 


    like you see, sometime there is   characther in the output, i want to replace that character in the output, please help what is looks like the right replacement code, this should be easy enough, already tried this but its looks like still not right


    $nbsp =  ;
    $peoplenamereplaced = str_replace($peoplename, $nbsp, $peoplenamereplaced);
    Make the world better

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,734
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    are you trying to replace white space?

    $peoplenamereplaced = str_replace(" ", "", $peoplenamereplaced);

    If you are actually outputing  
    $peoplenamereplaced = str_replace(" ", "", $peoplenamereplaced);

    hope that helps

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    Aveiro, Portugal
    Posts
    164
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi basketmen,

    I think it should be:

    PHP Code:
    $nbsp ' ';
    $peoplenamereplaced str_replace($peoplename$nbsp$peoplenamereplaced); 
    because   is a string.

    HTH
    Yours truely
    Mário Ramos


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •