get_the_ID not returning correct ID value

The array intialize of the variable $valid_post_id is incorrect.

Change:

<?$valid_post_id('1','2','3','4');?>

to

<?php $valid_post_id = array('1','2','3','4');?>