Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
bwoebi
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
bwoebi
5mo ago
The key type changing is generally not a problem per se, but it's definitely odd with the default re-indexing behaviour depending on whether something is integer keys only or not. That's exactly what I've been complaining in
2.
▲
by
bwoebi
5mo ago
Arrays in PHP are mostly confusing if you are used to them in other languages. Instead of $array[0] - the first element is accessed via array_first(). Having them as key-value means, that you can easily just remove some items in the middle,
3.
▲
by
bwoebi
2y ago
C# 13 has this via the field keyword (as preview feature): https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... It's pretty similar to what PHP provides here, except that PHP uses "$this-
4.
▲
by
bwoebi
2y ago
While variable-length lookbehind is surely more comfortable to work with, I found clever usage of \K to be largely sufficient in most cases. But I agree, a great feature!
5.
▲
by
bwoebi
2y ago
readonly is rather a misnomer for "writeonce" in PHP. And as such it also disallows repeated assignment in class scope, while private(set) has no such restriction.
6.
▲
by
bwoebi
2y ago
array_find parameter ordering is modeled after other non-variadic array functions, e.g. array_filter also having ($array, $callback) order. But I agree, there is already some inconsistency, and when adding a new function you have to choose
7.
▲
by
bwoebi
2y ago
I found this approach works best with languages having method overloading. For PHP it felt quite limiting, and it also requires you to have more complexity and overhead with wrapping. But I have no hard evidence at hand, only how I experien
8.
▲
by
bwoebi
2y ago
One of the main advantages of actually allowing more arguments is forward compatibility: You can, within a library, provide an additional argument to a callback without actually introducing a BC break for all users. My favorite approach wou