Title: php  function &#039;count&#039; versus wordpress array field &#039;count&#039;
Last modified: August 21, 2016

---

# php function 'count' versus wordpress array field 'count'

 *  Resolved [Peter_L](https://wordpress.org/support/users/peter_l/)
 * (@peter_l)
 * [13 years ago](https://wordpress.org/support/topic/php-function-count-versus-wordpress-array-field-count/)
 * PHP has the [count function](http://php.net/manual/en/function.count.php), that
   counts the number of elements in an array.
 * I am currently using the WordPress function get_terms. This returns an array 
   with one of the fields inside this array called count. ( [http://codex.wordpress.org/Function_Reference/get_terms#Return_Values](http://codex.wordpress.org/Function_Reference/get_terms#Return_Values))
 * When I loop out this array, using foreach, I get to this line at a certain point:
   `
   $term->count` This should and does return the number of posts inside the currently
   looped taxonomy term.
 * Here’s my question: will the count in the rule above make the server think, hello
   php function. I am going to execute you and get an error somehow.
 * I don’t know how to say this more clearly. Isn’t count a php reserved term?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years ago](https://wordpress.org/support/topic/php-function-count-versus-wordpress-array-field-count/#post-3756214)
 * I think you have the answer in your question, it is just not obvious.
 * PHP has a ‘count’ function. $term->count is a reference to a data item named ‘
   count’. PHP can have a function and a data item both named the same thing without
   any conflict.
 *  Thread Starter [Peter_L](https://wordpress.org/support/users/peter_l/)
 * (@peter_l)
 * [13 years ago](https://wordpress.org/support/topic/php-function-count-versus-wordpress-array-field-count/#post-3756225)
 * Everything does work just fine, it just got me confused a bit.
    Thanks for answering.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘php function 'count' versus wordpress array field 'count'’ is closed 
to new replies.

## Tags

 * [count](https://wordpress.org/support/topic-tag/count/)
 * [get_terms](https://wordpress.org/support/topic-tag/get_terms/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Peter_L](https://wordpress.org/support/users/peter_l/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/php-function-count-versus-wordpress-array-field-count/#post-3756225)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
