Skip to content

Instantly share code, notes, and snippets.

@yitznewton
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save yitznewton/0e54a901a04e32434df3 to your computer and use it in GitHub Desktop.

Select an option

Save yitznewton/0e54a901a04e32434df3 to your computer and use it in GitHub Desktop.
PHP structs (hypothetical)
struct Person {
Age $age;
Address $address;
HairColor $hairColor;
Length $height?; // optional? not sure if worth it
}
$yitz = Person(
$age => new Age(30),
$address => $someAddress,
$hairColor => HairColor::BLONDE
);
echo $yitz->age;
// the output of (new Age(30))->__toString()
@yitznewton
Copy link
Author

The more I look at it, the more the idea of an optional member seems bad

@Antnee
Copy link

Antnee commented Jul 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment