Do variable names affect website performance? I know this will going to be very low number, but still can any one provide the reasons for not choosing a long variable name in aspect of performance?
No, it will not. Generally speaking, when code is compiled, the variable names are replaced by the memory address they refer to. Computers don't know anything about variable names; they only want to know where values are stored.
Variables are symbols, nothing more. They replace hex values with names so that programmers have an easier time understanding what they're doing. So, there will be no performance boost by choosing shorter variable names.
That said, you may get miniscule (and I'm talking microscopic) improvements in compile times and the JIT first interpretation, but that is only because the parser takes a few CPU cycles less to read the variable name. This is a one-time cost, and is statistically insignificant when worrying about performance.
can any one provide the reasons for not choosing a long variable name in aspect of performance?
Michael covered the answer (i.e. No) but variable names do affect programmer performance. If you bring on a new developer or someone who's unfamiliar with the code, then having long and/or confusing variable names can be distracting and slow the comprehension process.
In general, you want to use short, descriptive variable names because they're easier to read. Imagine if you have to ignore your code for 10 years and then understand everything again. Would you rather read "getInput" or "getInputFromUserWhoInputsStringOrElseInformReaderOfError" ? (exaggeration of course :P)
There are times, however, when having a slightly longer name can be beneficial. For example, getBirthdayInput() would be much more descriptive than getInput(). You want to simplify to a point but oversimplification can also be problematic.
Unless you're using op-code cache (also known as "PHP accelerators"), then there is indeed an impact. But that impact is so low, that it can be neglected. If you do use op-code cache, then there is zero impact.
While Michael is correct for application programming, your question is referring to web development with PHP, which is an interpreted language. In such a case, the code would need to be read in from file, then interpreted. In this case, a longer variable name will take longer to load & parse.
The performance hit with doing so however will be insignificant, and will probably be in the region of fractions of a millisecond for an entire script. You could always try it out with a sample script, and use a timing method such as that detailed at http://www.developerfusion.com/code/2058/determine-execution-time-in-php/ but this will probably not start timing until after the file has been read in. Additionally, the execution time between retries will vary far more than the difference between variable name lengths, so you will need to perform a significant number of retries and take the average of each before you can obtain a remotely meaningful average.
As BlackJack points out, longer names can be much more difficult to understand, and take a lot of extra effort to type out (and are much more prone to typo's). While there may be a tiny performance gain, this does not justify the extra hassle created for the programmer. As such, short, concise and easy to understand variable names are preferred.
So in short, don't worry about the variable length name, but instead concentrate on writing clean, meaningful code.
Yes, it will, but not in the sense you are thinking about.
With bad variable names, developers will get easily confused in the source code. It will be hard to read and hard to understand.
In the end, the source code will be hard to maintain and it will be nearly impossible to make it evolve. This will lead inevitably to higher maintenance costs, higher development costs, more bugs, and poorer performances.
Variable name will have absolutely no influence at runtime, and totally negligible at compile time. But bad names will inevitably lead to bad performance because nobody understand the code and it ends up in a stack of hack one on top of another, making things worse each time.
Read these to know about good variable name: http://tottinge.blogsome.com/meaningfulnames
Note that if you feel the need of very long variable name, it means that your code is poorly architectured. A variable name is always expressed in a context: namespace, class name, filename, folder, function name, etc. Thus, if the name need to be long to be explicit, this means that the thing that you are trying to name DOESN'T BELONG HERE. In this case, think about putting this code in the appropriate place, or create that place if it doesn't exist yet.