Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    1,236

    str_replace question

    ok im makeing a reviews script for someone

    and i want them to be able to use bbcode in their posts instead of html.

    I am using str_replace() to do this, but i have a problem.

    i can do this fine :

    PHP Code:
    $reviews_post str_replace("[b]""<b>"$reviews_post); 
    but how do you do it if you want to change not only [b] to <b> but and to <b> and </b> in one go?

    Thanx

  2. #2
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    1,236
    ok that post has come out all wrong because it is converting the bbcode to bold

    is there not a way to turn it off in a post?

  3. #3
    Join Date
    Oct 2002
    Posts
    58
    I you want to show bbcode in a post you can place bbcode in a bbcode to break it up; like this: [B]wassup![/B] (quote me and see what i mean)

  4. #4
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,100
    From Manual: In PHP 4.0.5 and later, every parameter to str_replace() can be an array.

    That might mean that this will work:

    PHP Code:
    str_replace (array('[b[I][/I]]''[[I][/I]/b]') , array(<b>', '</b>') ,$str) ; 

Posting Permissions

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