Results 1 to 3 of 3

Thread: str_replace parse error *** RESOLVED ***

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    South Wales (UK)
    Posts
    83

    str_replace parse error *** RESOLVED ***

    I've got the following line of code in a php page:
    PHP Code:
    $ProjectReference str_replace("\","/",$ProjectReference); 
    But I'm getting a parse error as follows:
    Parse error: parse error, unexpected T_STRING in c:\inetpub\wwwroot\specac_test\ppc\nuaire_form_save.php on line 142

    I've got a feeling it doesn't like the backslash, as other str replaces work ok?

    Any ideas?
    Last edited by aaronskw; Apr 5th, 2004 at 09:44 AM.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    the backslash is used to escape characters that PHP will useto define strings or print out variables. like so:
    PHP Code:
    $var "blah \"escape\" blah"
    it you want to have a backslash, do a double backslash, "\\", PHP will recognize and escape the second backslash using the first, if that makes sense, and will only give you one backslash.
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    South Wales (UK)
    Posts
    83
    thnx kows,

    Yeah I realised about 10 mins after i posted and the magical light bulb came on in my head, which is rare.

    Thanks anyway

Posting Permissions

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



Click Here to Expand Forum to Full Width