php - 我们怎么称呼这个?

标签 php naming

我想知道我们如何称呼这种作业。

<?php
class SimpleClass
{
    public $var1;
    public $var2;
    public $var3;

    public function SimpleClass()
    {
        $this->var1 = 'one';
        $this->var2 = 'two';
        $this->var3 = 'three';
    }
}

function test()
{
    $objSc = new SimpleClass();
    $objSc->var4 = 'WTF?!'; # <-- what do we call this?
    var_dump($objSc);
}

test();
?>

更好的引用或链接。提前致谢!

编辑:我正在为它寻找一个技术术语......好吧,如果我们有的话。

最佳答案

我认为这是重载。

Overloading in PHP provides means to dynamically "create" properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types.

The overloading methods are invoked when interacting with properties or methods that have not been declared or are not visible in the current scope.

PHP 手册引用 here .

关于php - 我们怎么称呼这个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2919406/

相关文章:

php - 构建 'simple' php url 代理

html - 层次结构应该包含在 css 名称中吗?

python - 如何检查一组文件是否符合命名方案

php - 配置 : error: utf8_mime2text() has new signature, 但缺少 U8T_CANONICAL

PHP 网络应用程序国际化

javascript - 结合php、html和js,没有渲染正确的js

javascript - 函数和方法同名,不能在后者中调用前者

java - 为什么这里会出现 javax.naming.NamingException?

javascript - 是否有一个词同时涵盖 Null 和 Undefined?

php - 如何在 Laravel 中应用 Mysql AND/OR 子句