how will alternative to Split('sunset.jpg') in PHP shows output?
<p>Please help me to find the answer for the following php code in 5.3.5 and above.</p>

<pre><code>$file_name ="sunset.jpg";
if(isset($file_name))
{
    $exts = split("[/\\.]", $file_name) ;
    $n = count($exts)-1;
    echo $n;
    $exts = $exts[$n];
    echo $exts;
}
else
{
    echo "error";
}
</code></pre>

<p>I know that split() function is deprecated and we have to use preg_split (or) explode instead. But my question here is how should I modify my code to get the output as just 'jpg' only. When I tried to use explode and preg_split I got the result as 'sunset.jpg'.
Help to find the result.</p>
