Given a blog's (subdomain or directory) name, retrieve it's id.
<?php get_id_from_blogname( $slug ) ?>
Getting the the id of a blog by name ($slug)
$slug = 'first-site'; $id = get_id_from_blogname($slug);
Switching blogs based on the blogs name ($slug)
$slug = 'another-site'; $id = get_id_from_blogname($slug); switch_to_blog($id); // do great things restore_current_blog();
Since: 3.0.0
get_id_from_blogname() is located in wp-includes/ms-blogs.php