<?php
$str = '3803_452.jpg';
$chars = preg_split('/_/', $str, PREG_SPLIT_OFFSET_CAPTURE);
if(count($chars) < 2)
{	$ext = pathinfo($str);
	$chars = $ext['filename'];
	echo $chars;
}else
{	echo $chars[0];
}
