2014-12-17 3 views
-3

자사의 유선 질문 대 물결과 동등 일치하지만 난 "문자열"내가 찾으려고 노력하고 다음 =~==정규식 이중 등호

의 차이가 무엇인지 알고 싶어요.

if($ua =~ "friendly-scanner") { 
    drop() 
} 

if($ua == "friendly-scanner") { 
    drop() 
} 

답변

1
=~ - Does a regular expression matching 
== - Compares two for equality 

:

if($ua =~ "^friendly") is "$ua begins with friendly" 
if($ua == "friendly") is "$ua exact match with friendly"