3 ms·
I'm kinda hijacking this thread because I always wonder how to handle vars in PHP. Should we use short named vars like $a, $b? Should we avoid always using the
by baby 15y ago
I'm kinda hijacking this thread because I always wonder how to handle vars in PHP. Should we use short named vars like $a, $b? Should we avoid always using the same var and changing its type? $a = 30; $a = "thing";
- ars 15y agoSomeone downmodded you for being offtopic, but I'll answer you anyway. The name of the var doesn't matter at all. And you can change the type of a var at will. There is nothing at all in PHP that will be better if you avoid changing the type, so just do what is clearest for your program.
- conradfr 15y agoI don't think someone picking up your code will be pleased with all variables named $a :) Use "long" names and use unset() if worried about memory consumption. And more on topic, you can use unset on a array item !