If
-
[PHP & Codeigniter] Comparison operator problem 비교 연산자 문제PHP & Codeigniter 2018. 12. 25. 16:50
php 에서는,보통 == 은 그냥 그대로고, === 은 데이터는 물론 데이터 타입까지 체크를 한다. 이걸 알나낸 계기가 0 == 'admin' 이라고 했을때, == 로 하면 'admin' 을 타입캐스팅을 해버리기 때문에 true 가 return 이 된다(0=0) 그래서 === 로 체크 하면 된다, 즉 왼쪽 기준으로 오른쪽의 데이터 타입을 맞추기 때문에. Normally, '==' is same as the other languages, but in PHP there're some problem for type casting. When you try 0 == 'admin', you think this is false, but these are difference type of variables, so go..