They do it because they aren't returning data, they are echoing. You can do print_r($array, true) to make it return, but var_dump() will need output buffering.
If you want it to work the way you're trying to make it, separate them into distinct calls.