[wp-trac] [WordPress Trac] #56499: count() used in the loop condition

WordPress Trac noreply at wordpress.org
Mon Sep 19 20:20:59 UTC 2022


#56499: count() used in the loop condition
-------------------------------------+-------------------------------------
 Reporter:  krunal265                |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Comments                 |     Version:  6.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  administration,
  reporter-feedback                  |  coding-standards
-------------------------------------+-------------------------------------

Comment (by krunal265):

 @audrasjb, We can use do...while loop in this issue instead of while loop.
 From this change, coding standards and readability will improve. Because
 the use of count() inside a loop condition is not allowed; assign the
 return value to a variable and use the variable in the loop condition
 instead.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56499#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list