Wpis z mikrobloga

http://news.php.net/php.internals/91907
Kolejny zabawny dzień w internalsach

Hi internals!

For consistency, we should add a spaceship assignment operator:

$a <=>= $b;

// same as

$a = ($a <=> $b);


Additionally, we should add an is-identical assignment operator:

$a ==== $b;

// same as

$a = ($a === $b);


I wouldn't dismiss this idea straight off. I can see a lot of practical

uses for chaining assignment operators, like:

$a !==<=>==== $b;


Expanded from:

$a = $a !== (($a <=> $b) === $b);


Which is something I often do in my production applications. In fact I

typed this exact use case about 12 times just today.


It's a good, expressive way of simplifying code and increasing readability.

This would really complete the language IMO.


#php
  • 2