PHP code example of ntzm / icecream

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

    

ntzm / icecream example snippets


use function IceCream\ic;

function foo($i) {
    return $i + 333;
}

ic(foo(123));
// Outputs:
// ic| foo(123): 456

ic(1 + 5);
// Outputs:
// ic| 1 + 5: 6

ic(foo(123), 1 + 5);
// Outputs:
// ic| foo(123): 456, 1 + 5: 6

function bar() {
    ic();
}
bar();
// Outputs:
// ic| example.php:18 in bar()

IceCream::setOutputFunction(function (string $message): void {
    file_put_contents('log.txt', $message . PHP_EOL, FILE_APPEND);
});

// Don't do this
ic('foo'); ic('bar');

// Don't do this
use function IceCream\ic as debug;
debug();

// Don't do this
$fn = 'IceCream\ic';
$fn();