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 6141793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:17:53+00:00 2026-05-23T18:17:53+00:00

I am just beginning to learn PHP and I am using PHP for the

  • 0

I am just beginning to learn PHP and I am using PHP for the Web: Visual Quickstart Guide 4th edition and I have a question about a script I learned in the book and just wrote.

This is the code of the script:

     print '<p>Thank you, ' .$title.$name. ' for your comments.</p>
    <p>You stated that you found this example to be "'.$response.'" and added:<br />'
    .$comments.'</p>';

    print "<p>Thank you, $title $name for your comments.</p><p>You stated that you found this example to be '$response' and added:<br/>$comments</p>";

This script is just displaying some data from an HTML form that is pulled via POST.

What is the correct way to do this? I am having a lot of trouble understanding ' vs " in this context.

The second example is the one out of the book and the first example is one that I found how to do after trying to understand the ‘ vs ” question. In regards to this, where is a good location to find information about ' vs ".

  • 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-23T18:17:55+00:00Added an answer on May 23, 2026 at 6:17 pm

    Double quoted strings get parsed by the PHP parser for variables and escaped characters like \n

    $x = 10;
    echo "$x dollars"; // Outputs: 10 dollars
    

    Single quoted strings do not get parsed so:

    $x = 10;
    echo '$x dollars'; // Outputs: $x dollars
    

    and to output 10 dollars you would need to do string concatenation:

    $x = 10;
    echo $x.' dollars';
    

    Parsing variables within strings uses more memory and takes more time than string concatenation. So single quotes are almost always the better way to go. Even though the difference is small.

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

Sidebar

Related Questions

Just beginning to learn about structs, I thought I understood how they work, using
I'm just beginning to learn Java and I have been very frustrated about learning
I'm just beginning to learn python. I wrote an example script to test OOP
I'm just curious as I am beginning to learn PHP and MySQL, as to
I am just beginning to learn SQL and have stumbled at the first hurdle,
I am just beginning to learn Matlab , so this question might be very
I'm just beginning to learn OpenCV and I would like to ask about how
I am new to linux, and just beginning to learn bash. I am using
I'm just beginning to learn about the differences between how css (and html) is
I'm just beginning to learn about file compression and I've run into a bit

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.