PHP code example of germania-kg / nullfactory

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

    

germania-kg / nullfactory example snippets



use Germania\NullFactory\NullFactory;

$nf = new NullFactory;
$result = $nf( "anything" );
// null


use Germania\NullFactory\NullFactory;

$default_value = array("foo", "bar");

$nf = new NullFactory( $default_value );
$result = $nf( "anything" );
// array("foo", "bar")


use Germania\NullFactory\NullFactory;
use Psr\Log\NullLogger;

$nf = new NullFactory( null, new NullLogger );
$result = $nf( "anything" );