PHPのpreg_match

// サイトのURL
$site_url = 'https://hatena.webTurezure.jp/';
// 現在のURL 実際は動的に取得する
$current_url = 'https://hatena.1pages.jp/';

↓この場合×
echo( 'preg_match : ' . preg_match( '/' . $site_url . '/' , $current_url ) );

↓〇の書き方
// preg_match
echo( 'preg_match : ' . preg_match( '{' . $site_url . '}' , $current_url ) );

preg_match( '{https://hatena.webTurezure.jp/}' , $current_url )


出典:
www.1ft-seabass.jp