PHP code example of jamielsharief / struct

1. Go to this page and download the library: Download jamielsharief/struct library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jamielsharief / struct example snippets


use Struct\Struct;

class Contact extends Struct
{
    public string $name;
    public string $company;
    public string $email;
    public int $age;
    public bool $unsubscribed = false;
}

$contact = new Contact();
$contact->name = 'Jon';
$contact->email = '[email protected]';

$contact = new Contact([
    'name' => 'Jon',
    'company' => 'Snow Enterprises',
    'email' => '[email protected]',
    'age' => 33
]);