Suppose, I have a function such as: [$data
is a stdClass()
]
function test_1{
...
...
if (somecondition){
$data->name = NULL;
test_2($data->name);
}
else{
$data->name = 'hello';
test_2($data->name);
}
...
...
}
function test_2($data){
if (!empty($data->name)){
test_3($data->name);
}
else{
test_3();
}
}
function test_3($s = ''){
if (!empty($s)){
//do something
}
else{
$s .= 'World';
}
}
test_3
is the function with optional parameters.
However, I get an error: Object of class stdClass could not be converted to string