kphp icon indicating copy to clipboard operation
kphp copied to clipboard

empty function on tuples

Open vajexal opened this issue 4 years ago • 0 comments

Currently this code won't compile

$x = tuple(1, true);
var_dump(empty($x));
// error: no matching function for call to 'f$empty(std::tuple<long int, bool>&)'

But if we add implementation for tuple there is a bigger problem, empty on arrays

$results = [
  tuple(1, true),
];
var_dump(
  empty($results[0]), // false
  empty($results[1]) // false
);

this could be solved by making empty an operation (like isset)

vajexal avatar Nov 04 '21 13:11 vajexal