<?php
class test {
function test($p) {
$p[] = 'test';
}
}
$tp = ['asd','sad'];
$tc = new test();
$tc->test($tp);
var_dump($tp);
die;
abstract class T
{
static public $instanses;
final private function __construct(){
}
public static function getInstance()
{
if (!(static::$instanses instanceof static)) {
static::$instanses = new static;
}
return static::$instanses;
}
}
class A extends T
{
static public $instanses;
}
class B extends A
{
static public $instanses;
}
$t = A::getInstance();
var_dump($t);
$t1 = B::getInstance();
var_dump($t1);
new B();
?>
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; test has a deprecated constructor in /in/NvBaP on line 2
Fatal error: Uncaught ArgumentCountError: Too few arguments to function test::test(), 0 passed in /in/NvBaP on line 8 and exactly 1 expected in /in/NvBaP:3
Stack trace:
#0 /in/NvBaP(8): test->test()
#1 {main}
thrown in /in/NvBaP on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught ArgumentCountError: Too few arguments to function test::test(), 0 passed in /in/NvBaP on line 8 and exactly 1 expected in /in/NvBaP:3
Stack trace:
#0 /in/NvBaP(8): test->test()
#1 {main}
thrown in /in/NvBaP on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; test has a deprecated constructor in /in/NvBaP on line 2
Warning: Missing argument 1 for test::test(), called in /in/NvBaP on line 8 and defined in /in/NvBaP on line 3
array(2) {
[0]=>
string(3) "asd"
[1]=>
string(3) "sad"
}
Warning: Missing argument 1 for test::test(), called in /in/NvBaP on line 8 and defined in /in/NvBaP on line 3
array(2) {
[0]=>
string(3) "asd"
[1]=>
string(3) "sad"
}