So can someone please help me and tell me what exactly I am doing wrong? Also is there a 'better' way to do it?
Thanks in advance for your time and efforts
NOTE: get_the_category and $category->cat_ID are two wordpress functions, which return the current category id and add it to the dynamic array
Code: Select all
<?php
unset($x);
unset($arr);
$x=array(4,3,7,1,31,43,38,63);
foreach((get_the_category()) as $category) {
$arr[] = $category->cat_ID ;
}
$result = array_intersect($x, $arr);
print_r($result);
?>