f2/globals

Provides a function `F2\globals(string $namespace):array` that allow you to save data without polluting the `$_GLOBALS` superglobal.

1.0.5 2019-12-29 00:27 UTC

This package is auto-updated.

Last update: 2024-11-29 06:09:53 UTC


README

Micro library enabling sharing of state without introducing global variables or using the $_GLOBALS super-global.

Using:

<?php
use function F2\globals;

function example() {
    $globals = &globals("package/name");

    print_r($globals);
    $globals[] = date("Y-m-d H:i:s");
}