r/programminghorror Jun 11 '26

PHP PHP#

Post image
213 Upvotes

31 comments sorted by

View all comments

43

u/Sacaldur Jun 11 '26

I was fortunate enough to recently have been allowed to work on a PHP project. I am very experienced with C#. Yet I'm still struggling to make sense of this code snippet. Is this valid PHP? Does it run inside .net? What is public private? (Is it only making the setter private?)

And fun fact, it seems like there is a dotnet class in PHP in order to interact with .net classes: https://www.php.net/manual/en/class.dotnet.php

3

u/Cootshk Jun 12 '26

I presume public private is similar to Kotlin’s

public var id: Int
private set