Counting items in an array.
Posted: Thu Aug 11, 2011 4:23 am
hi everyone,
i need to count items in an array but after hours of searching, i thought i'd see if someone could point me in the right direction.
i have a field in a table with items separated by commas. i need to count those items.
$result[$fruits] is referring to a column in a query. Does anyone have any helpful hints? thanks.
i need to count items in an array but after hours of searching, i thought i'd see if someone could point me in the right direction.
i have a field in a table with items separated by commas. i need to count those items.
$result[$fruits] is referring to a column in a query. Does anyone have any helpful hints? thanks.
Code: Select all
<?php
$items = $result['fruits'];
$items= array($items);
$itemcount= count($items);
?>