[TYPO3] function itemFromListinList()

Jo Schneider typo3listmember at typo3cms.info
Mon Mar 20 16:41:35 CET 2006


Hello List,

i was wondering, if there already is a function like this in TYPO3. 
Please let me know, if so. Or let me know, if there is a better way to 
do this. You may use this funktion as you like on you own risk.


Best wishes!
Jo
---

    /**
     * function itemFromListinList()
     * Check for every item of a comma-separated list, if any item from list
     * exists in a comma-separated list of items and returns count int 
of found items.
     * jo.schneider at typo3cms.info 20MAR2006
     * @param   string  $inList is the list, where to search in.
     * @param   string  $fromList is the list, where there elements are 
taken from to find in $inList.
     * @return  int     The amount of items found.    
     **/
    function itemFromListinList($inList='',$fromList='') {
        $fromListArr=t3lib_div::trimExplode(',',$fromList);
        $count=0;
        foreach($fromListArr as $item) {
            if(t3lib_div::inList($inList,$item)) $count++;
        }
        return $count;
    }




More information about the TYPO3-english mailing list