heavy-tools.eu
8 Février 2021 à 03h18 - 8965

Ways to code the same in PHP

Advent of Code is a programming exercise advent calendar. Every day a new one, and the difficulty gradually rises. It's completely free, just create an account to participate. Each retrieves a set of data of its own each day and must therefore submit THE associated response, which is always a numeric value to find. Each day offers 1 exercise broken down into 2 levels of difficulty, one affordable, and another much more complicated ... The choice of language is free since we simply retrieve an input in text format. It will therefore be necessary to resolve the problem locally.

Typing in PHP Well, it's been around for a long time, but a reminder doesn't hurt. As I started coding without typing in PHP, I wasn't always strict about this aspect. But now I can't do without. In php web development, it is possible to type: The parameters of a function or method The return of a function or method The properties of a class

We could ask ourselves "what is the point of typing"? Typing will allow you to strengthen and secure your code. Indeed, PHP throws a fatal error if the typing is not respected. For a method, no more need to test the nature of the parameter (s), PHP will do it directly. If you structure a function with a precise expected return type, if the function evolves and this return changes, similarly, PHP raises a fatal error. This is just a taste of what you can do with typing, so please refer to the official documentation for more information.

Respect the protections in the classrooms

This is a question of good practice. As with typing, this best practice allows you to strengthen and secure your code. You create a new class, declare it as "final". You create properties or methods, declare them as "private". And you only change if you need to, that way you have a class that is always secure.

Official

  1. 12 Avril 2021Does ecommerce plateform influence hosting?1447
  2. 31 Déc. 2020SEO and php it works together !492
  3. 3 Oct. 2020Get the best Php web development possible328
  4. 2 Sept. 2020Your Php web development project with SimplyPhp353