<?php $str='yang.zai.lu.jpg'; echo strrchr($str,'.'); echo '<br>'; echo substr($str,strrpos($str,'.'));