Skip to content

RecordSet::count

James Cobban edited this page Apr 5, 2019 · 3 revisions

$recordSet->count()

Up: class RecordSet

This method returns the number of records that operations on this instance apply to. For example this is the number of records that will be iterated over by a foreach statement, the number of records that will be deleted by calling the delete method, or the maximum number of records that will be updated by calling the update method. This value is the lesser of getInformation()['count'] or the LIMIT value specified in the parameters to the constructor. For convenience this can be accessed either by $set->count() or by count($set) as if the object was an array. However the object-oriented style of call is recommended.

The following example determines how many names there are with surname 'Smith':

$set		= new RecordSet('Names', array('surname' => 'Smith'));
$count	        = $set->count();

Next: foreach($recordSet as $key => $record)

Clone this wiki locally