<?php function str_begins($haystack, $needle) { return 0 === substr_compare($haystack, $needle, 0, strlen($needle)); } function str_ends($haystack, $needle) { return 0 === substr_compare($haystack, $needle, -strlen($needle)); } // https:// 문자열로 시작했는지? 검사 var_dump(str_begins('http://www.nanumtip.com', 'https://')); // .com 문자열로 끝났는지? 검사 var_dump(str_begins('http://www.nanumtip.com', '.com')); ?>