Writing PHP

While it is almost certain that you read this book to learn the PHP programming language, I believe that there is a lot more to learning a language than just memorising its syntax and functions. For example, learning to program to a fixed style means your code will be easier to maintain by yourself and by others, and learning to debug properly means your code will have fewer bugs and you will have fewer headaches.

This chapter is designed to fill you in on the practical aspects of being a PHP programmer, and should hopefully make your programming life easier, as well as help you find and solve problems with the minimum of fuss.

The topics covered in this chapter are:

  • How to analyse your system requirements

  • Using a development tool to help you code

  • File layout schemes and group development

  • Documentation and testing

  • Distribution your code and licensing your work

  • How to debug your scripts

  • Troubleshooting hints and tips

  • Where to get help if you still have a problem

Chapter contents

  1. 19.1. The design process
    1. 19.1.1. Analysing the requirements
    2. 19.1.2. Designing the solution
    3. 19.1.3. Developing the code
    4. 19.1.4. Implementing the application
    5. 19.1.5. Maintenance and support
  2. 19.2. Which IDEs are good
    1. 19.2.1. Line numbering
    2. 19.2.2. Syntax highlighting
    3. 19.2.3. Online help
    4. 19.2.4. Code insight
    5. 19.2.5. Interactive debugging
    6. 19.2.6. Profiling
    7. 19.2.7. Popular IDEs
  3. 19.3. Laying out your files
    1. 19.3.1. Directory structuring
  4. 19.4. Group development
    1. 19.4.1. How to develop code
    2. 19.4.2. Version control
  5. 19.5. Documenting your project
  6. 19.6. Testing
  7. 19.7. Distributing your code
    1. 19.7.1. Charging for your work
    2. 19.7.2. PHP Encoders
    3. 19.7.3. Cross-platform code 1: Loading extensions
    4. 19.7.4. Cross-platform code 2: Using extensions
    5. 19.7.5. Cross-platform code 3: Path and line separators
    6. 19.7.6. Cross-platform code 4: Coping with php.ini differences
    7. 19.7.7. Cross-platform code 5
  8. 19.8. Debugging
    1. 19.8.1. What is a bug?
    2. 19.8.2. The most basic debugging technique
    3. 19.8.3. Making assertions
    4. 19.8.4. Triggering your own errors
    5. 19.8.5. Source highlighting
    6. 19.8.6. Handling MySQL errors
    7. 19.8.7. Exception handling
    8. 19.8.8. Backtracing your code
    9. 19.8.9. Debuggers
    10. 19.8.10. Custom error handlers
    11. 19.8.11. Custom exception handlers
    12. 19.8.12. Using @ to disable errors
    13. 19.8.13. phpinfo()
  9. 19.9. Debugging practice
  10. 19.10. Coding style
    1. 19.10.1. Comments and whitespace
    2. 19.10.2. Variable naming
    3. 19.10.3. Functions
    4. 19.10.4. Distinguishing code blocks
  11. 19.11. Output style
    1. 19.11.1. Options for Tidy
  12. 19.12. Troubleshooting
    1. 19.12.1. Error types
    2. 19.12.2. Choosing what types of errors you see
    3. 19.12.3. Common errors
  13. 19.13. Getting Help
    1. 19.13.1. The documentation
    2. 19.13.2. Mailing lists
    3. 19.13.3. Websites
    4. 19.13.4. IRC
    5. 19.13.5. Conferences
    6. 19.13.6. User groups
    7. 19.13.7. Submitting a bug
    8. 19.13.8. Contacting the author
  14. 19.14. Getting qualified
  15. 19.15. Summary
  16. 19.16. Exercises
  17. 19.17. Further reading
  18. 19.18. Next chapter

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: The design process >>

Previous chapter: Next chapter

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.