I have this code here:
$imagePreFix = substr($fileinfo[\'basename\'], strpos($fileinfo[\'basename\'], \"_\") +1);
this gets me everything after
If you want an old-school answer in the type of what you proposed you can still do the following:
$imagePreFix = substr($fileinfo['basename'], 0, strpos($fileinfo['basename'], "_"));