Using end() with explode() does not work

you can not use end() like you are doing since

end() -> Parameters ¶ The array. This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference.

so do like

$feature_icon ="image.jpg";
$upload_extension =  explode(".", $feature_icon);
$upload_extension = end($upload_extension);
var_dump($upload_extension );

Live result


Try doing it like this separately:

 $upload_extension = explode(".", $feature_icon);
 $upload_extension = end($upload_extension);