.net framework 4.0 40 signs that you are still a PHP newbie
Jul 29, 2016 am 08:38 AMI would like to include this article in my "Programming Mistakes" series. Although I have been exposed to software engineering, enterprise software architecture and database design in regular university courses, I still feel the "guilt" of the following facts from time to time. Of course, these are all my subjective feelings and are oriented towards Eclipse:
You are a PHP newbie if you:
1. Don’t know how to properly comment your code using tools like phpDoc
2. Turn a blind eye to good integrated development environments like Zend Studio or Eclipse PDT
3. Never Have used any form of version control system, such as Subclipse
4. Do not adopt certain coding and naming standards, as well as common conventions, and cannot implement them in the project development cycle
5. Do not use a unified development method
6. Do not convert (or ) nor validate certain inputs or SQL query strings (Translation: refer to PHP related functions)
7. Do not plan your program thoroughly before coding
8. Do not use test-driven development
9. Do not code and test with errors enabled (Annotation: refer to the PHP function error_reporting)
10. Turn a blind eye to the benefits of the debugger
11. Not refactor your code
12. Not use an MVC-like pattern to separate different levels of the program
13. Don’t know these concepts: KISS , DRY, MVC, OOP, REST
14. Instead of returning, directly output (echo/print) content in your function or class
15. Turn a blind eye to the advantages of unit testing or general testing
16. Always return hard coding HTML, but does not return pure data, strings, or objects
17. Always hardcode "message" and "configuration parameters"
18. Do not optimize SQL query statements
19. Do not use __autoload (translation annotation) : Refer to the relevant description in the PHP manual)
20. Intelligent error handling is not allowed (Translation: refer to PEAR's ErrorStack)
21. Use $_GET instead of $_POST to do destructive transfer operations
22. Don't know how to use regular expressions
23. Never heard of SQL injection or cross-site scripting
24. Simple configuration is not allowed, and the constructor of the class is not allowed to accept parameter transfer and then execute the set/get method, or constant definition at runtime
25. Don’t understand Advantages and Disadvantages of Object-Oriented Programming (OOP)
26. Abusing OOP regardless of the size of the situation
27. Thinking that achieving reusable software must equal/need to make your code follow OOP
28. Not utilizing smart defaults
29. There is no single configuration file
30. I don’t want to expose the file source code, but use the .inc suffix instead of .php
31. Don’t use the database abstraction layer
32. Can’t maintain the DRY style, that is, don’t repeat yourself, if you always You are copying and pasting something, which shows that your design is poor
33. There is no implementation of a function/class/method that only does one thing, nor can they be combined and used
34. Failed to try the strengths of OOP, such as abstract classes, Interfaces, polymorphism, inheritance, access control modifiers (Annotation: such as public, private, protected)
35. Do not use existing design patterns to optimize your program architecture design
36. Do not allow your users to operate when you have many files or Define the basic directory in the case of a directory
37. Pollute the namespace, such as naming your library functions with common strings
38. Do not use table prefixes when using database tables
39. Do not use a unified template engine
40. Don’t follow The existing PHP development framework is too lazy to explore; in fact, advanced development concepts and wonderful code are contained in it.
Translation Note: There is also a translated version of "40 Bad Habits of PHP Programmers" by Ma Yongzhan, which is concise and equipped with translator's notes.
The above introduces .net framework 4.0 40 signs that you are still a newbie in PHP, including the content of .net framework 4.0. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

ToversionaPHP-basedAPIeffectively,useURL-basedversioningforclarityandeaseofrouting,separateversionedcodetoavoidconflicts,deprecateoldversionswithclearcommunication,andconsidercustomheadersonlywhennecessary.StartbyplacingtheversionintheURL(e.g.,/api/v

TosecurelyhandleauthenticationandauthorizationinPHP,followthesesteps:1.Alwayshashpasswordswithpassword_hash()andverifyusingpassword_verify(),usepreparedstatementstopreventSQLinjection,andstoreuserdatain$_SESSIONafterlogin.2.Implementrole-basedaccessc

Proceduralandobject-orientedprogramming(OOP)inPHPdiffersignificantlyinstructure,reusability,anddatahandling.1.Proceduralprogrammingusesfunctionsorganizedsequentially,suitableforsmallscripts.2.OOPorganizescodeintoclassesandobjects,modelingreal-worlden

PHPdoesnothaveabuilt-inWeakMapbutoffersWeakReferenceforsimilarfunctionality.1.WeakReferenceallowsholdingreferenceswithoutpreventinggarbagecollection.2.Itisusefulforcaching,eventlisteners,andmetadatawithoutaffectingobjectlifecycles.3.YoucansimulateaWe

To safely handle file uploads in PHP, the core is to verify file types, rename files, and restrict permissions. 1. Use finfo_file() to check the real MIME type, and only specific types such as image/jpeg are allowed; 2. Use uniqid() to generate random file names and store them in non-Web root directory; 3. Limit file size through php.ini and HTML forms, and set directory permissions to 0755; 4. Use ClamAV to scan malware to enhance security. These steps effectively prevent security vulnerabilities and ensure that the file upload process is safe and reliable.

Yes, PHP can interact with NoSQL databases like MongoDB and Redis through specific extensions or libraries. First, use the MongoDBPHP driver (installed through PECL or Composer) to create client instances and operate databases and collections, supporting insertion, query, aggregation and other operations; second, use the Predis library or phpredis extension to connect to Redis, perform key-value settings and acquisitions, and recommend phpredis for high-performance scenarios, while Predis is convenient for rapid deployment; both are suitable for production environments and are well-documented.

In PHP, the main difference between == and == is the strictness of type checking. ==Type conversion will be performed before comparison, for example, 5=="5" returns true, and ===Request that the value and type are the same before true will be returned, for example, 5==="5" returns false. In usage scenarios, === is more secure and should be used first, and == is only used when type conversion is required.

The methods of using basic mathematical operations in PHP are as follows: 1. Addition signs support integers and floating-point numbers, and can also be used for variables. String numbers will be automatically converted but not recommended to dependencies; 2. Subtraction signs use - signs, variables are the same, and type conversion is also applicable; 3. Multiplication signs use * signs, which are suitable for numbers and similar strings; 4. Division uses / signs, which need to avoid dividing by zero, and note that the result may be floating-point numbers; 5. Taking the modulus signs can be used to judge odd and even numbers, and when processing negative numbers, the remainder signs are consistent with the dividend. The key to using these operators correctly is to ensure that the data types are clear and the boundary situation is handled well.
