The super global array $_POST is populated depends on the form value setnt through the client's POST request. If a field to key hello exists, the value will be populated to the $_POST["hello"] field accordingly.
However, if there is not value to the key, $_POST["hello"] does not exist. And accessing an non-exists key in an array would result in 2 issues:
Using a NULL in functions may results in unexpected behaviour. As @amadan mentioned in his comment, some programmers uses type casting to cast undefined values from NULL into string to prevent such issue.
However, the warning is not suppressed.
Better solution
Started from PHP 7, now you may use the null coalesce operator (the ?? sign) to both suppress the warning and to force a value if a key is not defined:
$info = pathinfo($_FILES['receipt']['name'] ?? '');
$name = strtoupper($_POST['name'] ?? '');
$arrdate = date("j M Y", strtotime($trdate ?? ''));
Null coalesce operator detects if the former operator is NULL or undefined, and then fallbacks to later value. For example:
$value = $_POST["hello"] ?? "my default";
If $_POST["hello"] is defined, then $value will be assigned to $_POST["hello"]. If not, then $value will be assigned the fallback value "my default" here.
$_FILES['receipt']['name']wasNULL, casting it to string would make it"". $\endgroup$$_FILES['receipt']['name']may or may not exist. If it exists, it'll be a string no matter what because PHP itself populates it; if it doesn't, a cast to string will still throw a warning. Same problem with$_POST['name']but, also, if it's an array you'll get an Array to string conversion warning anyway. $\endgroup$