Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不确定它是否称为组输入,但我的意思是:
由于 PHP 是动态类型的,这增加了可以理解的延迟。是否可以在 PHP 中创建某种类型系统,以便
ints,floats 和其他数值可以在 Number 下分组,以及其他类型的分组以提高运行速度,这样如果变量是 Number 类型,在运行时,PHP 可以快速只检查该组,甚至无需测试是否它是字符串或其他类型。
这是可能的,还是我在这里完全错过了什么?
你错过了一些东西。数字和字符串不是 PHP 中的对象——它们是一种独特的值类型,已经或多或少地以您描述的方式处理。
您根本无法在 PHP 中做到这一点,该语言没有那种工具。