Comment Re:PHP is an ugly programming language (Score 1) 519
stristr( $haystack, $needle ) for checking if one string is contained in another versus in_array( $needle, $haystack )
Netbeans, PHP support, Alt+Space. Problem solved
Generally, PHP all the way for me, without web frameworks or anything. Some things that I find helpful in PHP:
- Heavily use the object-oriented features (e.g. use classes with static methods for lexical scoping).
- Liberally add comments in the source code (makes the Netbeans autocompletion/help work nicely).
- Make one central database access library in your project (based on PDO), and use that library throughout your project.
- Define central configuration in a config.php file.
- Separate presentation-oriented PHP files (to be treated as "templates") and back-end (which have a starting php tag at the beginning, and no ending tag throughout the file).
- Use AJAJ (with JSON) if needed. Both PHP and Javascript can do it natively, and it's faster and much simpler than XML.
- Consider REST-style interfaces if your project is big.
- Use sane parameter semantics: POST parameters in forms, GET parameters only very rarely.
- Use the PHP session to store context.
- Do not trust user input; check string lengths, options, and run all inputs through regexes to validate the allowed characters. Put this string/number/option checking code into a separate backend library, and use that everywhere else.