- in_array: documentation ( source)
<?php
$types = array('Forex+Metals'); // Specify types
$needleTypes = array(
'Forex+Metals',
'Metals',
'CFDStocks',
'CFDFutures',
'CFDStocksRU',
'Unknowns',
); // Get valid types
$typesStr = array();
foreach ($types as $type) {
echo $type . PHP_EOL;
if (in_array($type, $needleTypes)) {
$typesStr[] = $type;
}
}