PHP code example of victorwesterlund / globalsnapshot
1. Go to this page and download the library: Download victorwesterlund/globalsnapshot 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/ */
victorwesterlund / globalsnapshot example snippets
// Initial state
$_ENV["hello"] = "world"; // echo: "world"
// Capture initial state
$snapshot = (new GlobalSnapshot())->capture();
// Manipulate superglobals
$_ENV["hello"] .= " and mom!"; // echo: "world and mom"
// Restore initial state
$snapshot->restore();
// Initial state restored
echo $_ENV["hello"]; // echo: "world"
use victorwesterlund\GlobalSnapshot;
// Initialize a new GlobalSnapshot instance to store current values (one snapshot per instance)
$snapshot = new GlobalSnapshot();
// Capture current superglobal state
$snapshot->capture();
// ... some other code
// Restore superglobals to state of `capture()`
$snapshot->restore();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.