PHP code example of lpeltier / struct
1. Go to this page and download the library: Download lpeltier/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/ */
lpeltier / struct example snippets
use lpeltier\Struct;
class Foo
{
use Struct;
public $foo = 'default';
public $bar;
}
$foo = new Foo(['bar' => 0x2A]);
var_dump($foo->foo); // 'default'
var_dump($foo->bar); // 42
var_dump($foo->baz); // throws an exception