Doc #79673 [Com]: "roughly equivalent to" without explaining the difference
Edit report at https://bugs.php.net/bug.php?id=79673&edit=1
ID: 79673
Comment by: alexinbeijing at gmail dot com
Reported by: kasperheij at hotmail dot com
Summary: "roughly equivalent to" without explaining the
difference
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: 7.4.6
Block user comment: N
Private report: N
New Comment:
Interesting question!
I can't find any difference in the actual behavior, although the bytecodes executed by the
interpreter are different in either case, so it is possible that there might be some (very small)
difference in performance.
See:
https://3v4l.org/Z3dPV/vld#output
https://3v4l.org/2W7W1/vld#output
Previous Comments:
------------------------------------------------------------------------
[2020-06-04 11:21:51] kasperheij at hotmail dot com
Description:
------------
---
From manual page: https://php.net/migration74.new-features
---
```
<?php
$array['key'] ??= computeDefault();
// is roughly equivalent to
if (!isset($array['key'])) {
$array['key'] = computeDefault();
}
?>
```
"// is roughly equivalent to" says that there _is_ a difference without specifying this
delta.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79673&edit=1
Thread (7 messages)