<?php
class testo{
public $val='oo';
public function __construct($val){
$this->val = $val;
}
}
// your code goes here
$t = new testo();
$a=$t->val='ok';
echo $a ;
$tt = new testo('ooooh');
echo $tt ;
Fatal error: Uncaught ArgumentCountError: Too few arguments to function testo::__construct(), 0 passed in /in/4Eh8s on line 18 and exactly 1 expected in /in/4Eh8s:7
Stack trace:
#0 /in/4Eh8s(18): testo->__construct()
#1 {main}
thrown in /in/4Eh8s on line 7
Process exited with code 255.
Warning: Missing argument 1 for testo::__construct(), called in /in/4Eh8s on line 18 and defined in /in/4Eh8s on line 7
Notice: Undefined variable: val in /in/4Eh8s on line 9
ok
Catchable fatal error: Object of class testo could not be converted to string in /in/4Eh8s on line 23
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Warning: Missing argument 1 for testo::__construct(), called in /in/4Eh8s on line 18 and defined in /in/4Eh8s on line 7
Notice: Undefined variable: val in /in/4Eh8s on line 9
okObject id #2
Output for 5.0.0 - 5.0.5
Warning: Missing argument 1 for testo::__construct() in /in/4Eh8s on line 7
okObject id #2
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/4Eh8s on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/4Eh8s on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/4Eh8s on line 4
Process exited with code 255.