3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { // isPrivateSet() = true (OK) public private(set) mixed $public_private_set; // isPrivateSet() = false (I would expect true) private private(set) mixed $private_private_set; // isPrivateSet() = false (I would expect true) private mixed $private; // isProtectedSet() = true (OK, explained in the RFC) public readonly mixed $public_readonly; // isProtectedSet() = false (I would expect true) protected readonly mixed $protected_readonly; // isProtectedSet() = false (I would expect true) protected protected(set) readonly mixed $protected_protected_set_readonly; } foreach (new ReflectionClass(A::class)->getProperties() as $property) { echo $property->name; echo ': isPrivateSet() = ', $property->isPrivateSet() ? 'true' : 'false'; echo ', isProtectedSet() = ', $property->isProtectedSet() ? 'true' : 'false'; echo PHP_EOL; }

preferences:
146.52 ms | 992 KiB | 7 Q