define에 의해서 선언된 값은 상수로 변경이 불가능하며(상수니까)
$로 변수 식별자 없이 바로 사용이 가능하다.
<?php define ('YEAR', 3000); echo YEAR; ?> |
[링크 : http://php.net/manual/kr/language.constants.php]
+
Performance results
| Test performed | Time spent | Memory consumed |
| Using define() | 100% | 32.6% |
| Using class constants | 30.2% | 100% |
| Using apc_define_constants() | 24.2% | 32.0% |
| Using hidef | 13.9% | 13.5% (*) |
(*) hidef consumes memory during initialization, but this was not taken into account for this test
[링크 : http://shwup.blogspot.com/2010/04/about-constants.html]
[링크 : http://stackoverflow.com/questions/148185/how-efficient-is-define-in-php]
'Programming > php' 카테고리의 다른 글
| php hidef? (0) | 2017.04.24 |
|---|---|
| php static과 변수 유효범위 (0) | 2017.04.15 |
| php 세션주의사항(?) (0) | 2017.04.13 |
| php mvc 구현(+ PDO) (2) | 2017.04.07 |
| php mysql 자동증가값 받기 (0) | 2017.03.14 |
