$value = 'foo'; $list = 'foo, bar, baz'; if (t3lib_div::inList($value, $list)) { echo 'Value is present in list'; } else { echo 'Value is not present in list'; }
$value = 'foo'; $array = array('foo', 'bar', 'baz'); if (t3lib_div::inList($value, implode(',', $array))) { echo 'Value is present in array'; } else { echo 'Value is not present in array'; }In this example, we are checking if the value 'foo' is present in an array. Since the inList function works with comma-separated lists, we are first converting the array into a comma-separated list using the implode function. The output will be 'Value is present in array' since the value 'foo' is present in the array. Overall, t3lib_div is a useful package library in TYPO3 CMS that provides various utility functions to simplify development tasks.