PHP code example of mnapoli / number-two

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

    

mnapoli / number-two example snippets


echo NumberTwo::dump(null);
// null

echo NumberTwo::dump(true);
// true
echo NumberTwo::dump(false);
// false

echo NumberTwo::dump(1);
// 1

echo NumberTwo::dump('foo');
// "foo"

echo NumberTwo::dump(array('foo', 'bar'));

[
    0 => "foo"
    1 => "bar"
]

echo NumberTwo::dump(array('foo' => 'bar'));

[
    "foo" => "bar"
]

echo NumberTwo::dump($object);

My\ClassWithPublicProperties {
    foo: "aaa"
    bar: "bbb"
}

echo NumberTwo::dump($otherObject, 2);

UnitTest\NumberTwo\PublicProperties {
    foo: UnitTest\NumberTwo\PublicProperties {
        foo: UnitTest\NumberTwo\PrivateProperties { ... }
        bar: null
    }
    bar: null
}

$filters = array(new MyFilter());

echo NumberTwo::dump($otherObject, 2, $filters);

use NumberTwo\Filter\DoctrineCollectionFilter;

$filters = array(new DoctrineCollectionFilter());

echo NumberTwo::dump($otherObject, 2, $filters);

use NumberTwo\Filter\DoctrineProxyFilter;

$filters = array(new DoctrineProxyFilter());

echo NumberTwo::dump($otherObject, 2, $filters);