<?php
class testo{
public $valeur='oo';
public $n='';
public function __construct($valeur){
$this->valeur = $valeur;
}
public function setName($nam){
$this->n = $nam;
}
}
// your code goes here
$t = new testo();
$a=$t->valeur='ok';
echo $a ;
$tt = new testo('ooooh');
echo $tt ;
Fatal error: Uncaught ArgumentCountError: Too few arguments to function testo::__construct(), 0 passed in /in/TIn9f on line 25 and exactly 1 expected in /in/TIn9f:8
Stack trace:
#0 /in/TIn9f(25): testo->__construct()
#1 {main}
thrown in /in/TIn9f on line 8
Process exited with code 255.
Warning: Missing argument 1 for testo::__construct(), called in /in/TIn9f on line 25 and defined in /in/TIn9f on line 8
Notice: Undefined variable: valeur in /in/TIn9f on line 10
ok
Catchable fatal error: Object of class testo could not be converted to string in /in/TIn9f on line 30
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Warning: Missing argument 1 for testo::__construct(), called in /in/TIn9f on line 25 and defined in /in/TIn9f on line 8
Notice: Undefined variable: valeur in /in/TIn9f on line 10
okObject id #2
Output for 5.0.0 - 5.0.5
Warning: Missing argument 1 for testo::__construct() in /in/TIn9f on line 8
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/TIn9f 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/TIn9f 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/TIn9f on line 4
Process exited with code 255.