note 129928 added to function.uasort
| From: | raveren@gmail.com | Date: | Sat, 21 Dec 2024 09:31:59 +0000 |
| Subject: | note 129928 added to function.uasort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221735@lists.php.net to get a copy of this message | ||
Since php7.0 you can replace this boilerplate
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
with the spaceship operator:
https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.spaceship-op
return $a <=> $b;
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 78.56.81.36)
----
Manual Page -- https://php.net/manual/en/function.uasort.php
Edit -- https://main.php.net/note/edit/129928
Del: integrated -- https://main.php.net/note/delete/129928/integrated
Del: useless -- https://main.php.net/note/delete/129928/useless
Del: bad code -- https://main.php.net/note/delete/129928/bad+code
Del: spam -- https://main.php.net/note/delete/129928/spam
Del: non-english -- https://main.php.net/note/delete/129928/non-english
Del: in docs -- https://main.php.net/note/delete/129928/in+docs
Del: other reasons-- https://main.php.net/note/delete/129928
Reject -- https://main.php.net/note/reject/129928
Search -- https://main.php.net/manage/user-notes.php