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

  • SEARCH
  • Home
  • 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 1095805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:11:02+00:00 2026-05-17T00:11:02+00:00

As you know, a good programmer is a lazy programmer, but I’m just lazy.

  • 0

As you know, a good programmer is a lazy programmer, but I’m just lazy. My question is this: Is there a simpler way to print out an element of an array (from a MySQL query) in a PHP echo statement?

I usually do this:

echo "string start " . $array['element'] . " string end";

It works FINE, I’d just like a shorter way of printing it out, because echo sees the “[‘element’]” bit of the variable as a string. I could use list() to get all the elements, but that’s not what I’m after.

So, are there any answers out there?

Thanks for reading,

James

  • 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-17T00:11:03+00:00Added an answer on May 17, 2026 at 12:11 am

    As I heavily dislike interpolating variables in strings I prefer using echo with several arguments:

    echo 'string start ', $array['element'], ' string end';
    

    Apart from this being faster then string concatenation (.) it deals better with echoing results of expressions, because , has the lowest of all precedences.

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

Sidebar

Related Questions

i don't know good title but heres the explain i have this link <a
I know that this question asked a lot (i think) but i could not
I consider myself to be quite a good programmer but I know very little
Are there any plugins/addons/website services which support good multi-programmer programming? Just like Google Documents
[UPDATE] (when you read my question this is good to know) I had a
I am a pretty good programmer(IMO only, of course. Know Python, Java well. Tried
Would like to know what a programmer should know to become a good at
I want to know a good way of converting the Model to ViewModel and
I am a systems programmer, so i just know some basic css/html. I like
Introduction Hello, I'm that typical programmer that know how to use api, but tend

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.