There is also a shorter way:
<?php
// The ip addresses to be banned separated by |
$ban = "34.43.97.31|86.53.73.27|41.107.14.621";
// Store current user's IP in a variable
$visitor = $_SERVER['REMOTE_ADDR'];
// Split the IPs using |
$list = explode("|", $ban);
if(in_array($visitor, $list)) {
die("You are banned from this site");
}
?>
Also note, that this wont always work. Not because your code is wrong, but some people have a dynamic IP so it wont always be the same. Another case of when it wont work is if the user is using a Proxy.