DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Coding
  3. Languages
  4. Writing Better PHP: Three Guides

Writing Better PHP: Three Guides

John Esposito user avatar by
John Esposito
·
Dec. 13, 11 · Interview
Like (0)
Save
Tweet
Share
9.00K Views

Join the DZone community and get the full member experience.

Join For Free

It's true that, in some sense, programming is all the same; and in some sense, thinking about assembly is a good way to think about programming in general. But even if 'assemble, link, load' is a good way to think about programming, it's probably a very confusing way to think about programs written in a high-level language.

Sometimes, then, improving your generic 'programming brain' will help you improve your facility with a particular language. At other times, it's more important to learn the nuances of a language, paying close attention to the kind of applications the language is used for. Like as a carpenter can improve his general ability to measure things, or learn a lot about lathes in particular -- and in fact the carpenter always needs to improve both.

For improving your PHP, then, you can do two things: become a better programmer; and understand PHP more finely, more deeply.

These three guides better your PHP, ordered from most programming-general to most PHP-specific:

  • 10 Tips for Writing Better PHP Code is really ten tips for writing better code, period. You probably won't learn anything absolutely new from this guide ('name your variables and functions well', 'comment your code', 'test your code often'), but it reminds you of the basics and offers a few reasons for why best general programming practices are particularly important for apps written in PHP. 
  • How To Write Better PHP Code: These 7 Ways addresses some temptations PHP developers are especially likely to face (not using templates, encapsulating too little, confusing PHP and SQL for CRUD), and offers ways to eliminate kinds of sloppiness especially likely to harm the performance of PHP apps ('reduce db queries' for high-volume web applications, for example).
  • The How to write better PHP code sticky on codingforums.com's PHP forum zeroes in on issues extremely specific to PHP and web applications (keeping HTML, CSS, JavaScript, and PHP separate; evil magic quotes; avoiding XSS attacks with htmlentities()) and particular systems commonly used with PHP (MySQL, JavaScript, Bash. This is the best resource for 'always do this particular thing that wouldn't have been obvious to anyone lacking PHP/MySQL experience, even if said person is a good programmer in general'.

All three are worth reading, depending on what you're going for.

PHP

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Custom Validators in Quarkus
  • Isolating Noisy Neighbors in Distributed Systems: The Power of Shuffle-Sharding
  • Spring Boot vs Eclipse MicroProfile: Resident Set Size (RSS) and Time to First Request (TFR) Comparative
  • How Elasticsearch Works

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: