new \ stdClass continues to show warning "Creating default object from empty value"

0

I have the following php code

    $obj = new \stdClass;

    foreach($_GET as $key => $value) {
        $obj->get->$key = $value;
    }

    foreach($_POST as $key => $value) {
        $obj->post->$key = $value;
    }

    return $obj;

The code works normally however the php warning

  

Warning: Creating default object from empty value in C: \ Users \ User \ Desktop \ loren \ core \ Route.php on line 31

continues to be shown even though I instantiating stdClass

What should be done?

    
asked by anonymous 29.03.2018 / 01:54

0 answers