Functionally Equivalent Language Translation →
(define const-name const-value) (define PI 3.14159) (define* MyThing "Cool")
This is used to define a constant into the output code. The var-name and the expression must be valid to the back-end coder. Using the define*
version means that the back-end coder is to make the definition case-sensitive.
Running the above examples through the PHP back-end:
define('PI', 3.14159); define('MyThing', "Cool", TRUE);
You can see that the define*
for the last one has made the PHP coder use the TRUE value in the define command to cause the name to be case-sensitive at run-time.
And the javaScript back-end:
var PI = 3.14159; var MyThing = "Cool";
javaScript doesn't really have the notion of a formal constant and so the usual practice is to use all uppercase for the names and define that as file level scoped variables so that they can be used everywhere.