Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3855334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:45:36+00:00 2026-05-19T17:45:36+00:00

Possible Duplicate: Is there a performance benefit single quote vs double quote in php?

  • 0

Possible Duplicate:
Is there a performance benefit single quote vs double quote in php?

Which is faster, single or double quotes and why?

Also, what is the advantage of using either method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:45:37+00:00Added an answer on May 19, 2026 at 5:45 pm

    Depends what you want to do. I just did some benchmarks and tested string assignment with a 5 test cases: double quotes + variable, double quotes, double quotes and string append, single quotes, and single quotes with string append.

    My test code. A million loops. String assignment.

    <?php
    
    $start = microtime(true);
    
    $str = "";
    
    for($i = 0; $i<1000000; $i++)
    {
            $str = "hello $i";
    }
    
    $end = microtime(true);
    
    echo $end - $start;
    

    Results:

    Single and Double quotes strings without variables are equally as fast. (each echoed around .08).
    Single and Double quote string with variable concatenation are about the same, but slower than no variable. (each echoed around .17-.20)
    Double quotes with a variable in the string was slowest (around .20-.25)

    So Single/Double doesn’t really matter, but it seems string concatenation is faster than variable replacement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Reference: Comparing PHP's print and echo Is there any major and fundamental
Possible Duplicate: Is there a performance difference between BETWEEN and IN with MySQL or
Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc What
Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc. I
Possible Duplicate: Array versus List<T>: When to use which? Is there any best practice
Possible Duplicate: Is there a performance difference between i++ and ++i in C++? In
I am using SQL Server 2008. I have tables on which there are duplicate
Possible Duplicate: Reading/Writing MS Word files in Python I know there are some libraries
Possible Duplicate: What should a good BugTracking tool be capable of? Although there is
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.