Function can see variable

I would use pathinfo() to get file extension and check it:

$ext = strtolower(pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION));

if (in_array($ext, ['jpg', 'jpeg', 'gif', 'png', 'bmp'])) { .... }

Also note that JPEG file can have .jpeg extension (4 letters) which is valid too