'How do I display an image after you've made your selection with a php Array?

My question is, what would be the best way to go about this?

<?
if (in_array("1434", $category)) {
  if($item > 0) {
    $wc_product = wc_get_product($item);
    echo '<img src="' . get_the_post_thumbnail_url($item, 'medium') . '">'; 
  }
}
?>

[1]:



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source