I want to read a variable from inside a weird function that I copied from this git .
This is the original function:
$values = array_map(function ($value) use ($connection) {
if ($value===null) return null;
// return mysqli_real_escape_string($connection,(string)$value);
return pg_escape_string($connection,(string)$value);
},array_values($input));
and I changed it into this in order to adapt it to my needs (file upload)
$values = array_map(function ($value) use ($connection) {
if ($value === null)
return null;
if (gettype($value) === "array"){
$tmpname=$value['tmp_name'];
$value=$value['name'];
}
return mysqli_real_escape_string($connection, (string) $value);
}, array_values($input));
The problem is that I can't read $tmpname
from outside this function.
Can anyone help me?