The subtle difference is that files that end in .jpg will get $search_full_name=false and those that end in .png won't.  External to the function it looks identical (as it should!), but internally it works quite differently.