3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function isGif($url) { $url = is_array($url) && !empty($url)? $url[0] : $url; return $url && strlen($url) !== 0 && strtolower(substr($url, -4)) === '.gif'; } var_dump(isGif([])); var_dump(isGif(['test.gif'])); var_dump(isGif(['test.jpeg'])); var_dump(isGif('test.gif')); var_dump(isGif('test.jpeg'));
based on rdZOv
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0beta1
bool(false) bool(true) bool(false) bool(true) bool(false)