If statement parsing incorrectly
问题 I am trying to get this if statement to follow as: if the first string position is .png, then get $png1 from a haystack, but if the first string position is .jpg, then get $jpg1 from the haystack, but if it is .gif, get $gif1 from haystack, else if none of them are found then the string position is .bmp so get $bmp1 Here is what i tried, but it doesn't parse correctly: <?php // if first occurence is .png get $png1 needle from haystack if (preg_match('#cid:([^"@]*).png@([^"]*)#', $html_part))