SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    685
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Brackets in PHP variable

    I am needing to create a variable that contains closing brackets like below:

    PHP Code:
    $third =   "[one_third]"
    I am getting the following error when trying to do so:


    Parse error: syntax error, unexpected '[' in /home/sample/public_html/test.php on line 1

    Is there a way I can close out the bracket(s) in order to eliminate this error?

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,122
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    I don't get an error...
    PHP Code:
    <?php
    $third 
    =   "[one_third]";
    Are you sure that is what your code actually looks like?

  3. #3
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Works for me too!
    Denny Schlesinger
    web services

  4. #4
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    should not give any error. check the following test page.
    http://codepad.org/MMDjJvbI


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
  •