function check_origin() { echo ($_SERVER['HTTP_REFERER']); return(substr_compare($_SERVER['HTTP_REFERER'], "mydomain.com", 11, 12, true)); } and I am trying to call this function with: echo (check_origin()); in order to see if it returns 0