PHP code example of bermudaphp / var-export

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

    

bermudaphp / var-export example snippets



$closure = static function (string $filename) use ($fileReader): string {
    return $fileReader->read($filename);
});

dd(export_closure($closure));

^ """
static function(string $filename) use($fileReader): string {
    return $fileReader->read($filename);
}

$closure = static fn(): string => __FILE__ ;

dd(export_closure($closure));

^ "static fn(): string => 'path/to/closure/filename'"

class A {
    public function call()
    {
        $closure = fn(): string => self::class ;
        dd(export_closure($closure));
    }
}

^ "fn(): string => \A::class"