3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Testing { public string $ok_public; protected string $ok_protected; private string $ok_private; public protected(set) string $wrong_public_protected_set; public private(set) string $wrong_public_private_set; protected private(set) string $wrong_protected_private_set; } $r = new ReflectionClass('Testing'); foreach($r->getProperties() as $rp) { echo $rp->getName() . ": "; echo $rp->getModifiers() . ": "; echo implode(", ", Reflection::getModifierNames($rp->getModifiers())) . "\n"; }
Output for 8.4.1 - 8.4.12
ok_public: 1: public ok_protected: 2: protected ok_private: 4: private wrong_public_protected_set: 2049: public wrong_public_private_set: 4129: final, public wrong_protected_private_set: 4130: final, protected
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
Fatal error: Multiple access type modifiers are not allowed in /in/2VF1L on line 9
Process exited with code 255.

preferences:
154.84 ms | 997 KiB | 7 Q