Comparison of the two variables

I want to compare two variables like:

$user_role = $user_data->roles;
$post_role = get_field('choose_user_role', $child->ID);

They have:

Read More
Array([0] => top_manager [1] => manager)

I try use

$intersection = array_intersect($post_role, $user_role);

but have error:

Warning: array_intersect(): Argument #1 is not an array

Related posts

Leave a Reply