变量名称的长度对PHP的性能有影响吗? [英] Does variable name length matter for performance in PHP?
问题描述
我已经看到了这个变量名称的长度对性能C#有影响吗? ?主题,对php也有同样的疑问.
I have been seen this Does variable name length matter for performance C#? topic and have same question about php.
我的同事(前端)已经编码过$ o,$ r,$ x,$ m,$ c之类的东西,并激发了它的最佳性能.我对此非常怀疑,并且代码变得难以阅读.
My co-worker (Front-end) have been encoded everything like $o, $r, $x, $m, $c and motivated it best performance. I really very doubt about it and code became difficult to read.
- $ o-对象或obj
- $ m-$ model
- $ r-$ query_result或$ result
- $ x-$ xml_node
每件事看起来
if ( isset ( self::$o[ self::$x -> name ] ) ) :
$c = 'ClassPrefix_' . self::$o[ self::$x -> name ];
$o = new $c;
self::$x -> read ( );
推荐答案
变量名称作为程序员的助手而存在-当解释程序或脚本时,变量名称将转换为内存位置.较短的变量只会在将来修改/调试代码时对程序员的性能产生负面影响.
Variable names exist more as a programmer aide - when a program or script is interpreted, these are converted into memory locations. Shorter variables will only negatively impact performance of the programmer(s) when modifying / debugging code in the future.
混淆是一种广泛使用的技术,涉及用单/多字符变量名替换变量名,但是该技术试图从易于获得/容易提取源代码的项目中进行逆向工程/提升核心技术.更加困难.
Obfuscation is a widely used technique that involves replacing variable names with single/multi-character variable names, but that is used in an attempt to make reverse engineering / lifting core technology from projects where the source code is readily available / easily extracted more difficult.
这篇关于变量名称的长度对PHP的性能有影响吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!