> Le 13 févr. 2023 à 13:12, Robert Landers <landers.rob...@gmail.com> a écrit :
> 
> I hope we can all agree that `null` is the absence of a value. Now we
> currently have two different meanings of "absence of a value" which is
> super annoying sometimes.
> 

Although `null` is often used with that semantics in mind, from a technical 
point of view, it is definitely not the same thing as “absence of a value”. For 
example:

```php
function dump_answer($answer = 42) {
    var_dump($answer);
}

// null
dump_answer(null); // NULL

// absence of value
dump_answer(); // int(42)

```

Or:

```php
$a = [ 'foo' => null ];

// has value `null`
var_dump(array_key_exists('foo', $a)); // true

// is absent
var_dump(array_key_exists('bar', $a)); // false
```

—Claude

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to