PHP code example of zero-config / clone

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

    

zero-config / clone example snippets



/** @var object $original */
$copy = deepClone($original);
$copy = 🐑($original);


use ZeroConfig\Cloner\Cloner;

/** @var object $original */
$cloner = new Cloner();
$copy   = $cloner($original);


// Define the timezone for Holland and Amsterdam during winter.
$winter = new stdClass();
$winter->amsterdam = new stdClass();
// Holland inherits from Amsterdam.
$winter->holland = $winter->amsterdam;

// Set the timezone offset for Amsterdam.
$winter->amsterdam->offset = '+1';

// Create a deep clone of the timezone to set the summer configuration.
$summer = 🐑($winter);

// Set the offset for Holland.
$summer->holland->offset = '+2';

echo json_encode(
    [
        'winter' => $winter,
        'summer' => $summer
    ],
    JSON_PRETTY_PRINT
) . PHP_EOL;