Skip to content
Advertisement

Tag: psr-12

PSR-12 and assigning same value to multiple variables

Is it allowed to assign multiple variables on the same line in PSR-12? For example: Answer Yes. If it’s not explicitly stated, then there is no standard. Either works. Also, chain assignment like that just makes the code cleaner so I personally would not see a reason to why it should not be allowed. https://www.php-fig.org/psr/psr-12/

PHP | define() vs. const

In PHP, you can declare constants in two ways: With define keyword Using const keyword What are the main differences between those two? When and why should you use one and when use the other? Answer As of PHP 5.3 there are two ways to define constants: Either using the const keyword or using the define() function: The fundamental difference

Advertisement