Lasso Soft Inc. > Home

[ array->count ]

Method

Returns the number of elements in the array that match value.

  • Syntax
array->count('search_term')
Examples
  • Beginner

Determine how many times an element appears in an array

This example returns the number of times John appears in a list of names.

Code

var( myNames=array('Tim', 'Jane', 'John', 'Stephanie', 'Jaques', 'John', 'Lucy', 'Wendy') )

var( myCount = $myNames->count('John') )

//output count
$myCount

Result

2

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft