Toot

Written by Tim Düsterhus on 2024-10-23 at 13:39

Really looking forward to be able to use property hooks with #php84:

final class Calculator

{

public Closure $add { get => static fn (int|float $a, int|float $b) => $a + $b; }

public Closure $subtract { get => static fn (int|float $a, int|float $b) => $a - $b; }

public Closure $multiply { get => static fn (int|float $a, int|float $b) => $a * $b; }

}

$myCalculator = new Calculator();

var_dump(($myCalculator->add)(40, 2));

var_dump(($myCalculator->multiply)(21, 2));

[#]PHP

=> More informations about this toot | View the thread | More toots from timwolla@phpc.social

Mentions

Tags

=> View php84 tag | View php tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113357015689440410
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
354.682922 milliseconds
Gemini-to-HTML Time
0.428356 milliseconds

This content has been proxied by September (3851b).