PHP code example of gcworld / globals
1. Go to this page and download the library: Download gcworld/globals 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/ */
gcworld / globals example snippets
use GCWorld\Globals;
# LOAD
$oGlobals = new Globals;
# DEFAULT
$oGlobals->filter(true);
# You can turn off by setting 'false'
# SET VAR
$oGlobals->GET('name', 'value');
# GET VAR
$var = $oGlobals->GET('name');
# FOR EXAMPLE :
$_GET['array'] = ['[email protected]', 'not an email'];
$_GET['notInt'] = '01234';
$_GET['int'] = '14244';
$_GET['_int'] = '-14244';
$_GET['float'] = '142.24';
$_GET['_float'] = '+142.24';
$_GET['bool'] = 'false';
$_GET['_bool'] = true;
$_GET['quote'] = '"';
# FILTER ALL
$var = $oGlobals->GET()->filterAll();
/**
["array"]
[0]=> string(17) "[email protected]"
[1]=> string(12) "not an email"
["notInt"]=> string(5) "01234"
["int"]=> int(14244)
["_int"]=> int(-14244)
["float"]=> float(142.24)
["_float"]=> float(142.24)
["bool"]=> bool(false)
["quote"]=> string(10) """
*/
# FILTER ONE (including array of elements)
$var = $oGlobals->email()->GET('array');
/**
["array"]
[0]=> string(17) "[email protected]"
[1]=> bool(false)
*/