PHP code example of elephox / support

1. Go to this page and download the library: Download elephox/support 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/ */

    

elephox / support example snippets




use Elephox\Support\TransparentGetterSetter;
use Elephox\Support\DeepCloneable;

class MyClass {
    use TransparentGetterSetter;
    use DeepCloneable;
    
    private int $foo = 1;
}

$instance = new MyClass();
$instance->setFoo(2); // uses __set implicitly

$clone = $instance->deepClone();
$clone->getFoo(); // 2
$clone->setFoo(3); // doesn't affect $instance