r/adventofcode • • Dec 05 '21

SOLUTION MEGATHREAD -🎄- 2021 Day 5 Solutions -🎄-

NEW AND NOTEWORTHY


Advent of Code 2021: Adventure Time!


--- Day 5: Hydrothermal Venture ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:08:53, megathread unlocked!

80 Upvotes

1.2k comments sorted by

View all comments

Show parent comment

2

u/Scroph Dec 05 '21

I was in the process of making a class similar to Point, then I did some googling and found that PHP now supports typescript-like syntax for constructor-initialized member variables :

class Point {
    public function __construct(public int $x, public int $y) { }
}

2

u/_Kowai_ Dec 06 '21

I didn't know that, thanks for the tip !