i'm trying to search a weather report for matches to my dictionary array but get an error Only variables can be passed by reference in the following code. i'm not much with loops so any help would be appreciated. is array_walk the best way to do this?
$word = explode (" ", $string);
function FindIt ($word){
foreach (array_keys($dictionary) as $term=>$definition) {
if ($word==$term){
echo "<B>$word</B> ($definition) ";
}
else {
echo "$word ";
}
}
}
array_walk ('$word', 'FintIt');
$dictionary = array (
'ABLATION' => 'The process of being removed. Snow ablation usually refers to removal by melting.',
'ACCRETION' => 'Growth of precipitation particles by collision of ice crystals with supercooled liquid droplets which freeze on impact.',
'AGE HARDENING' => 'The strengthening of snow after mechanical compacting (e.g., boot packing and ski packing).',
'ARTIFICIAL AVALANCHE' => 'Triggered by an animal, man or his equipment.',
$string = "
ZCZC SEASABNW TTAA00
NORTHWEST WEATHER AND AVALANCHE CENTER
NWAC Program administered by
USDA-Forest Service
thanks,
nick