我在哪里可以找到这个PHP代码中的“输入”声明? [关闭]

In a php code I found the code snippet:

class GF_Field extends stdClass implements ArrayAccess {

    if ( is_array( $this->inputs ) ) {
        foreach ( $this->inputs as $input ) {

But I don't know what is inputs come from.

Any help would be highly appropriated.

EDIT:

The programmer made two ambiguous step, which made me harder to find the declaration:

  1. Declared an object instance's property in the code as Felippe pointed below
  2. Made an assignment via referenced variable somewhere else in the code:

foreach ( $this->inputs as &$input ) { $input = something

You are ommiting code here, but for short answer, you don't have to explicitally define the attributes in PHP. You can create only for the object, and it will work like this:

class AnyClass extends stdClass {

    public function print() {
        if ( is_array( $this->inputs ) ) {
            foreach ( $this->inputs as $input ) {
                echo $input;
            }
        }
    }
}

$obj = new AnyClass;
$obj->inputs = [1,2,3];
$obj->print();

It will output 123.

stdClass is a generic class for PHP objects. ArrayAccess is a PHP interface. So, in your case, the $inputsis probably not defined anywhere in the class, or class tree, but is "defined" directly in the object instance.