Esempio n. 1
0
 public function test()
 {
     $x = new A();
     $x->var = 'var';
     $x->func();
 }
Esempio n. 2
0
<?php

class A
{
    function func(int $arg) : array
    {
        return 1;
    }
}
$a = A::func();
A::func($a);
        }
        if (count($arguments) === 2) {
            $this->func($arguments[0], $arguments[1]);
        } elseif (count($arguments) === 1) {
            $this->func($arguments[0]);
        } elseif (count($arguments) === 0) {
            $this->func();
        } else {
            echo "\n unknown method";
            return false;
        }
    }
    function func($a = null, $b = null)
    {
        echo "\n <br/> from function func, arguments = {$a} {$b}";
    }
    function func1($a = null)
    {
        echo "\n <br/> from function func1";
    }
    function func2($a = null, $b = null)
    {
        echo "\n <br/> from function func2";
    }
}
//
$objA = new A();
$objA->func('a');
$objA->func('a', 'b');
$objA->func('c');
$objA->func();