I’m looking for a way to get the values of params being set, whether it be passed it or pre-set. I tried using func_get_params(). While this does return the values being passed in, it doesn’t show if values are pre-set.
public function __construct($host = 'null', $user = null, $password = null, $database = null){
var_dump(func_get_args());
die();
$this->mysqli = new mysqli($host, $user, $password, $database);
if ($this->mysqli->connect_errno) {
echo("Connection failed: ". $mysqli->connect_error);
exit();
}
}
When no values are passed in, get an empty array output, instead of nulls. This also happens if I turn the nulls into strings.
Is there an alternative to func_get_args that also returns pre-set values?
Quite verbose, you see why named parameters or more fun to work with: