PHP code example of suin / livexample

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

    

suin / livexample example snippets




function hello(string $name): string {
	return 'hello ' . $name;
}
echo hello('alice') . "\n";
echo hello('bob') . "\n";

// Output:
// hello alice
// hello carol

use Livexample\PHPUnit\ExampleTestCase;

class ExampleTest extends ExampleTestCase
{
    public function exampleFiles()
    {
        // specify your example code directory.
        return self::exampleDirectory('example');
    }
}

echo 1; // Output: 1

echo "hello"; //=> hello

var_dump([1, 2, 3]);
// Output:
// array(3) {
// 	[0] =>
// 	int(1)
// 	[1] =>
// 	int(2)
// 	[2] =>
// 	int(3)
// }


var_dump(new stdClass);
// Output:
// object(stdClass)#%d (0) {
// }

php -d auto_prepend_file=vendor/autoload.php \
    -d xdebug.overload_var_dump=0 \
    example/simple-usage.php