+ 2
what is the specific use of constant?
if you could give me an example when to use it when there is a function that would change values.
11 Respuestas
+ 11
you can use it to declare databse arguments and it helps to protect them from changing. for example:
<?php
define("DB_NAME","dbname");
define("DB_USER","dbuser");
define("DB_PASSWORD","dbpassword");
define("DB_HOST","dbhost");
?>
so if a hacker attempts to change db info it will not change
+ 2
Just declare constant the stuff you don't wanna change.
+ 2
@bm i'm trying to get infos here.
@ahmed sorry i misunderstand what you said. i thought u said pls dont mind my question.
+ 1
please demonstrate in coding when any body asks for an example. here the example of a constant must be coding
+ 1
tysm Ilyosvek!
+ 1
please don't mind brother jaz. I was just presenting a suggestion because I m also a learner
+ 1
for more details ..u can visit 'w3school' in php section
+ 1
Use the constant when you define something, that never change in your project. Example: PI number is alway = 3.14.
So you use:
defint("PI", 3.14);
0
@viet if we try 2 change the constant value,is it change or it will display exception or new memory allocate for that variable and its value being changed
- 1
when u work on DBMS ..u will know by yourself;)
- 2
please don't mind