Nesting MYSQLi commands code : This question refers to nesting mysqli commands, i'm not sure the term "nesting" is the correct one here so i'll explain.  
Look at this code for example:

    $query = 'SELECT id FROM users WHERE id="' . $_POST['uid'] . '"';
    $result = $mysqli->query($query);
    $user_id = mysqli_fetch_row($result);

The code above can be turned into a *shorthand* version as follows:

    $user_id = mysqli_fetch_row($mysqli->query('SELECT id FROM users WHERE id="' . $_POST['uid'] . '"'));

I know this works because i've tried it. I see that PHP is taking care of the code from "inside-out", is it basically a recursive method to write this code or am I completely off with the terms?

My question is this, does this work for all MYSQL commands or PHP functions? are there exceptions for this functionality? what are the drawbacks to using such form? (besides it being less *readable* by a programmer)