Global variables and classes in php..
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/Athima
.gitignore
README.md

README.md

CHAOS

'One big global variable for php.'

Example

<?php

// sample of 'global'..
function foo_bar ($name, $color) {
\Athima\Chaos::unit()->var->colors[($name)] = $color;
}

// Start chaos
require_once(dirname(__FILE__).'/src/Athima/Chaos.php');
\Athima\Chaos::unit();

// Space for variables
\Athima\Chaos::unit()->var = new stdClass();

// Init some class
\Athima\Chaos::unit()->pdo = new PDO('...');

// Play with variables
\Athima\Chaos::unit()->var->colors = array(
    'red' => '#FF0000',
    'green' => '#00FF00',
    'blue' => '#0000FF',
);
foo_bar('black', '#000000');
\Athima\Chaos::unit()->var->colors['white'] = '#FFFFFF';

// Debug
echo '<pre>';print_r(\Athima\Chaos::unit());echo '</pre>';

?>