WEB This may be a retarded question but it has me wondering

Discussion in 'OT Technology' started by Browning, Jan 13, 2010.

  1. Browning

    Browning Active Member

    Joined:
    Feb 14, 2005
    Messages:
    89,465
    Likes Received:
    10
    I just bought a certain script and have it installed. I'm going through and changing a few things and noticed something that has me wondering. The guy has the href's setup two different ways, as shown below:

    Code:
    <a href='http://site.com'>blah</a>
    and

    Code:
    <a href="http://site.com">blah</a>
    Notice he used ' in the first one as opposed to ". Is there any difference or is this just a mistake on his behalf? I've always used the second.
     
  2. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,646
    Likes Received:
    15
    Location:
    Atlanta
    Same difference.
     
  3. Browning

    Browning Active Member

    Joined:
    Feb 14, 2005
    Messages:
    89,465
    Likes Received:
    10
    So there's no benefit of using one>the other? Struck me as odd that he uses both
     
  4. 2ofdem

    2ofdem OT Supporter

    Joined:
    Jun 17, 2003
    Messages:
    114,854
    Likes Received:
    8
    Location:
    aus.vic.mel
    Not an issue in straight html both are the same obviously when you get into php/asp/JS/SQL and shit you need to be real careful.
     
  5. Swerve

    Swerve OT Supporter

    Joined:
    Feb 20, 2005
    Messages:
    3,179
    Likes Received:
    3
    I would run it through a W3 compliance test and see if the first one fails strict.
     
  6. Phasm

    Phasm OT Supporter

    Joined:
    Sep 20, 2005
    Messages:
    9,680
    Likes Received:
    0
    Location:
    Michigan
    using ' as opposed to " is better for SE1 and SE2. Ninja Optimization 101...
     
  7. Supergeek

    Supergeek New Member

    Joined:
    Jan 23, 2007
    Messages:
    1,855
    Likes Received:
    0
    Location:
    Colorado
    If they're executed by a PHP interpreter, strings inside double quotes get evaluated for variables, while strings inside single quotes do not. Back in the day, the double quotes on a big site could add a small slowdown because of the extra check for variables, so people recommend single quotes unless you needed to embed a variable. (ASP and other interpreters may behave similarly, I dunno.)

    Outside of PHP code, I don't think it really matters, although the W3C standard may have something to say about it like Artificial said. Both work fine in all browsers.
     
  8. trev.the.enemy

    trev.the.enemy New Member

    Joined:
    Jun 26, 2006
    Messages:
    10,939
    Likes Received:
    0
    Location:
    Midwest
    :rofl:
     

Share This Page