[wp-trac] [WordPress Trac] #59777: WP admin : Use Yoda condition
WordPress Trac
noreply at wordpress.org
Fri Oct 11 06:20:40 UTC 2024
#59777: WP admin : Use Yoda condition
----------------------------+-------------------------------
Reporter: ashokrd2013 | Owner: (none)
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Administration | Version: 1.0
Severity: normal | Resolution: invalid
Keywords: has-patch | Focuses: coding-standards
----------------------------+-------------------------------
Comment (by uz01):
The expressions count($linkcheck) === 0 and 0 === count($linkcheck) are
functionally the same, but the second one (0 === count($linkcheck)) is
preferred. It allows the PHP compiler to optimize the code, making it more
efficient. Additionally, it's clearer and more readable, explicitly
showing that you are checking if the array is empty. This small change can
improve both performance and maintainability of the code.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59777#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list