Difference between revisions of "PHP"

From HypertWiki
Jump to navigation Jump to search
 
Line 4: Line 4:
*[http://php.net/ PHP Homepage]
*[http://php.net/ PHP Homepage]
==Newbie Traps & Pitfalls==
==Newbie Traps & Pitfalls==
Some mistakes I made when re-learning PHP in 2005 after not using it since 1997:
PHP will let you get away with a lot of syntax mistakes which are perfectly valid code but not what you intended. Most of the following produced no immediate error messages; the code simply wouldn't work, and it took me several edit-upload-run cycles to find each problem. Here are some mistakes I made when re-learning PHP in 2005 after not using it since 1997:
*Classes
*Classes
**Member vars and functions must ''always'' be referred to using '''$this->fname()'''
**Member vars and functions must ''always'' be referred to using '''$this->fname()'''
**However, var members do not take a $ prefix: '''$this->varName'''
**However, var members do not take a $ prefix: '''$this->varName'''
*Operators
**The "is equal to" comparison operator is "==" (as in c/c++), not "="

Revision as of 16:48, 24 July 2005

This article is a stub. You can help HypertWiki by expanding it.

Reference

Newbie Traps & Pitfalls

PHP will let you get away with a lot of syntax mistakes which are perfectly valid code but not what you intended. Most of the following produced no immediate error messages; the code simply wouldn't work, and it took me several edit-upload-run cycles to find each problem. Here are some mistakes I made when re-learning PHP in 2005 after not using it since 1997:

  • Classes
    • Member vars and functions must always be referred to using $this->fname()
    • However, var members do not take a $ prefix: $this->varName
  • Operators
    • The "is equal to" comparison operator is "==" (as in c/c++), not "="