Discussion

How to use PHP Static variables

Mainly we can use static variables in php. Especially I’d like to explain how to manage static variables in laravel.

Imagine there is categories (1 ~ 10).

ID 1 : Premiere Pro Category.
ID 2: After Effect Category.
….
ID 10: Music Category.

We can define static variables in Model of laravel.

for the example:

$CONST_PREMIERE_PRO_CAT = 1;
..
etc.

But for some reason, it is not good to define them in model.

So, we can create a class to manage static variables and use with cloning the class

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *