SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple php question

    $title = str_replace(" " & $strOne & " ", " " & $strTwo & " ", $title );


    no error, but it doesnt seem to work.

    $title = str_replace($strOne , $strTwo $title ); <-- if i do this, it works... but instead of replacing words it replaces anything that contains that work. for example, say strOne = he and strTwo = hello it will find anyword that contains the letter "he" and replace it with "hello" which is not what i want. i want to do word replacing, that's why i have the space around them

  2. #2
    SitePoint Zealot musher's Avatar
    Join Date
    Nov 2005
    Location
    Hull, England
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    & is the bitwise and operator, you need concatenation.

    PHP Code:
         $title str_replace(" " $strOne " "" " $strTwo " "$title ); 

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks alot!


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
  •