+ 6

PHP - Variables vs Constants - Case Sensitivity

I have been looking through the PHP lessons and understand that Variables are always case-senstive whereas Constants can be either case-sensitive or case-insensitive. Having no previous background in PHP this seems strange to have the option on one but not the other. Does anyone know why this is? Also why would you want to use case-insensitive?

21st Dec 2017, 9:42 PM
Duncan
Duncan - avatar
5 Answers
+ 28
It's more convenient and object-oriented.
22nd Dec 2017, 7:59 AM
Igor Makarsky
Igor Makarsky - avatar
+ 27
I just use "const". Never used define() function.
21st Dec 2017, 10:45 PM
Igor Makarsky
Igor Makarsky - avatar
+ 5
Is there a reason for that Igor?
22nd Dec 2017, 6:20 AM
Duncan
Duncan - avatar
0
I used π as constant in define( )function it's getting an error
27th Apr 2020, 11:25 AM
kongari omesh kumar
kongari omesh kumar - avatar
0
Men shunchaki "const" dan foydalanaman. Define () funktsiyasi hech qachon ishlatilmagan.
8th Nov 2020, 3:05 PM
Abduvosi Abdugafforov
Abduvosi Abdugafforov - avatar