I have to have the ability to test if $publish_count is equivalent to a variety inside a given array. Here's a good example of things i am attempting to achieve:

$posts_even = array(2,4,6,8,10);
$posts_odd = array(1,3,5,7,9);
$posts_ev3 = array(1,4,7,10);
$posts_ev4 = array(1,5,9);

--

$post_count=1;
$post_count=++; //in wordpress loop so each subsequent post is +1

--

if ($post_count= //any value in $posts_ev4) :
    echo 'this'
else :
    NULL;
endif;

I've been able to make this happen while using or operator however i finish track of very lengthy blocks of code.....

if (($post_count=1) || ($post_count=2)) :
    echo 'this'
else :
    NULL;
endif;

I'm speculating there's a less complicated method of doing this however i am a new comer to PHP so I don't know! Any help could be greatly appreciated.

Use in_array() to see if value is available in array.

Try:

if (in_array($post_count, $post_ev4)) {}

See: in_array()

if (in_array($post_count, $posts_ev4)) :
    echo 'this'
else :
    NULL;
endif;

Browse the isset() function within the PHP Manual.

You will find array functions in php. Ypu may use "is_array" function to check on be it array or otherwise. &lifier to look into the value you should use "in_array" function.

if(is_array($array) && in_array($post_count,$array))
{  
   // do operation
}