How to make a constant and use globally?



How to make a constant and use globally?..

Answer / Kamlesh Kaushal

To define a constant in PHP, you can use the `define()` function or declare it at the top of your script. To make it available globally, you should define it before any class declarations. For example:nn```phpndefine('MY_CONSTANT', 'some value');nclass MyClass {n //...n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What is the use of blade?

1 Answers  


How to create a controller in laravel?

1 Answers  


What is the directory structure of laravel 5.6?

1 Answers  


Write down the name of some aggregates methods provided by the laravel's query builder.

1 Answers  


What are pros and cons of using laravel framework?

1 Answers  


What is controller middleware in laravel?

1 Answers  


What is composer in laravel php?

1 Answers  


What is url helper?

1 Answers  


Define hashing in laravel.

1 Answers  


Which template engine is used by laravel?

1 Answers  


What is route parameters in laravel?

1 Answers  


How do you do dependency injection in laravel?

1 Answers  


Categories