How to Show or Hide Block Visibility in Drupal 8 Programmatically using PHP

Drupal 8 is made up of a number of Blocks. Each block represents one type of information. Also, each block has a place holder where it will be displayed. Some times it is necessary to show or hide blocks based on User Roles, specific path or pages. Visibility changes the way your Drupal Blocks appear to each user admin or anonymous.