Skip to content
Advertisement

Tag: php-7.1

How to specify the void return type for a constructor

For consistency I’m specifying return types since PHP 7.1, for all methods, including magic ones like __toString, and even when the implicit return type is void like with __unserialize(): When I try the same for constructors and destructors, like this: PHP yields Fatal errors: The only thing I can do right now is to specify the implicit return type in

2 dimensional associative array sorting with conditional statements in PHP

I’m having trouble figuring out how to solve this question, it’s from a free online test website. Here’s the link: https://www.testdome.com/questions/php/league-table/19939?questionIds=7278,19939&generatorId=30&type=fromtest&testDifficulty=Hard But to be clearer, I’m writing the question and my answer as well. The starting answer is there in the link written above. Question: The LeagueTable class tracks the score of each player in a league. After each game,

Advertisement