title | tags | cite | |||||
---|---|---|---|---|---|---|---|
stscoundrel/struct: Structs for PHP |
|
|
While we wait for [[PHP: rfc:structs]] to make some traction there are other solutions that attempt to bring Structs to #PHP. This one by Sampo Silvennoinen provides an AbstractStruct
class which can be extended to produce struct like behaviour. For example:
class Employee extends AbstractStruct
{
public string $name;
public string $department;
public int $salary;
}