Skip to content
//-->

Programming

17
Jun

Variable Naming in PHP

PHP is a loosely typed language, meaning any variable can be any type.  You could be using your variable as an integer one minute and then declare it as an array the next.

There are long-term repercussions  for avoiding to take care of your code.  Say you return to a project a year later to fix a bug.  You’re not going to have the crystal-clear understanding you had when writing it.  You’ll see all these variables and not know what is what until you go and debug your whole script to figure out what to change.  Variable naming schemes won’t eliminate this problem, but it’s going to save the first step by identifying what variables are which type.

Read moreRead more