<?php
class Human extends Data
{
public int $age;
public int $weight;
public int $height;
public string $name;
public ?string $address;
public function greeting(): string
{
return "Hello, my name is {$this->name}!";
}
}
$human = new Human([
'age' => 22,
'weight' => 51,
'height' => 172,
'name' => 'John',
'address' => '1600 Pennsylvania Avenue NW Washington, D.C. 20500 U.S.'
]);
-
Notifications
You must be signed in to change notification settings - Fork 0
tamiroh/php-dataclass
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Data class for PHP
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published