php - match multiple variable in preg_match -


hi cant find answer. got couple variable wanna use in preg_match can use 1 variable.

my code is:

    function imagetoday(){     global $imagetoday; if(preg_match_all('/rain.png/', $imagetoday)){     echo '<img src="assets/img/rain.png" class="img-responsive week" alt="responsive image">';     }  if(preg_match('/light_rain.png/', $imagetoday)){     echo '<img src="assets/img/light_rain.png" class="img-responsive week" alt="responsive image">';     }   if(preg_match('/partly_cloudy.png/', $imagetoday)){     echo '<img src="assets/img/partly_cloudy.png" class="img-responsive week" alt="responsive image">';     } } 

i tried use

if(preg_match('/light_rain.png/', $imagetoday, $imageday2, imageday3, $imageday4)){ echo '<img src="assets/img/light_rain.png" class="img-responsive week" alt="responsive image">'; } 

but doesnt work can me please? thanks!

like this:

if (preg_match('/(?:(?:light_)?rain|partly_cloudy)\.png/', $imagetoday, $match)) {     echo '<img src="assets/img/' . $match[0]        . '" class="img-responsive week" alt="responsive image">'; } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -