[DISCUSSION] Ternary nullcoalesce operator

From: Date: Thu, 20 Feb 2025 11:42:36 +0000
Subject: [DISCUSSION] Ternary nullcoalesce operator
Groups: php.internals 
Request: Send a blank email to internals+get-126462@lists.php.net to get a copy of this message
Now we have nullcoalesca operator in PHP: $a = $a ?? $b; And nullcoalesce assignment operator: $a ??= $b; (which is equivalent of previous example with nullcoalesce operator). Also we have a short syntax for ternary operator: $a = $a ?: $b; which is equivalent to: $a = $a ? $b : $a; Maybe we can make a syntax for assignment with short ternary operator? Somethink like that: $a ?:= $b; which would be an equivalent of: $a = $a ?: $b; I now, this looks ugly, but maybe we can find another tokens for this assignments?

« previous php.internals (#126462) next »