How to Get ID by Post / Page Name in WordPress

Hello friends,
I am sure! Once or ever you must have been searching for a function in wordpress which can just convert your page name or post name into Page Id. Wow! I have the solution. Please try this code let me know your experiences.

function wt_get_ID_by_page_name($page_name)
	global $wpdb;
	$page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."'");
	return $page_name_id;
Connect on Skype or Google+
A.Niraj Kumar’s Present Address
Siva Nagar
530018, (Vizag)
Andhra Pradesh, India
Photo of A.Niraj Kumar

Call New York (USA): +1-(646)-666-9606
Call London (UK): +44-020-3290-9606
Call India: +91-9492247412 (Mobile)