strpos($content,")") ???

Discussion in 'PHP' started by mahmood, Apr 30, 2006.

  1. #1
    It seems that php cannot undrestand the second bracket is a string and not end of function.

    Any idea guys?
     
    mahmood, Apr 30, 2006 IP
  2. Chicken

    Chicken Well-Known Member

    Messages:
    1,033
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    130
    #2
    I dont get what you mean?
    What do you want the second bracket to be?

    Edit: I get what you mean now sorry, lol took a second.

    You could substitute them with varibles like.
    $var = ")";
    strpos($content,"$var")
    Code (markup):
     
    Chicken, Apr 30, 2006 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What version of php do you have? echo strpos ('asdf)asdf', ')'); prints "4" for me.
     
    exam, Apr 30, 2006 IP
  4. mahmood

    mahmood Guest

    Messages:
    1,228
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I use version 5.

    I will try that $var, thanks.
     
    mahmood, May 1, 2006 IP
  5. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's most likely you have an error before the line where you call strpos, because if you enclose the ) in either single or double quotes, it'll work just fine.
     
    exam, May 1, 2006 IP
  6. chandubhai

    chandubhai Banned

    Messages:
    556
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #6
    whats wrong to it
    run this and check.
    <?
    $content = "find the bracket ) here";
    echo strpos($content,")");
    ?>
     
    chandubhai, May 2, 2006 IP
  7. JoeO

    JoeO Peon

    Messages:
    431
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That code works fine for me with PHP 5.1.3, it returns 17.
     
    JoeO, May 5, 2006 IP
  8. Edmunds

    Edmunds Peon

    Messages:
    136
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Ran it as well, works just fine for me. I use PHP 4.
     
    Edmunds, May 5, 2006 IP