PHP code example of ghostff / dump7

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

    

ghostff / dump7 example snippets


/**
* @dumpignore-inheritance
* @dumpignore-inherited-class
* @dumpignore-private
* @dumpignore-public
* @dumpignore-public
*/
Class Foo extends Bar {
    /** @dumpignore */
    private ?BigObject $foo = null;
}

class FooBar
{
    private $inherited_int   = 123;
    private $inherited_array = ['string'];
}

class Bar extends FooBar
{
    private $inherited_float = 0.22;
    private $inherited_bool  = 1 == '1';
}

class Foo extends Bar
{
    private $string = 'string';
    protected $int  = 10;
    public $array   = [
        'foo' => 'bar'
    ];
    protected static $bool = false;
}

$string   = 'Foobar';
$array    = ['foo', 'bar'];
$int      = 327626;
$double   = 22.223;
$null     = null;
$bool     = true;
$resource = fopen('LICENSE', 'r');
$m        = microtime(true);

new Dump(new Foo, $string, $array, $int, $double, $null, $bool, [
    'foo' => 'bar',
    'bar' => 'foo',
    [
        'foo' => 'foobar',
        'bar_foo',
        2 => 'foo',
        'foo' => [
            'barbar' => 55,
            'foofoo' => false,
            'foobar' => null,
        ]
    ]
], $resource);

new Dump(1 == '1', 1 === '1');
Dump::safe(...$args); # running on terminal without color capabilities.

# set($name, [$cgi_color, $cli_color]);
Dump::set('boolean', ['bb02ff', 'purple']);

function dump()
{
    Dump::setTraceOffset(2);
    new Dump(...func_get_args()); # Dont use this test.php(line:4) as call line
}

dump('foo', 22, 'bar', true); // Use test.php(line:7) instead