parent; if($parent=='0'){ //do something $catid = $catid. "'".$term->term_id."',"; } } echo "-->"; ?>