PHP code example of shortdark / lightswitch

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

    

shortdark / lightswitch example snippets




 = new Shortdark\Lightswitch();

// All you can do at the moment is to press the lightswitch
// press($lowest_integer, $highest_integer, $how_many_integers)
$result = $test->press(1,49,7);

// You can also specify two different rules, for example,
// 5 integers between 1 and 49, then 2 integers between 1 and 9
$result = $test->press(1,49,5,1,9,2);

// The result will be an array of integers
var_dump($result);




use App\Http\Controllers\Controller;
use Shortdark\Lightswitch;

class MyController extends Controller
{
    public function index(Lightswitch $light)
    {
        $result = $light->press(1,49,5,1,9,2);
        return view('index', compact('result'));
    }
    
}

{{ json_encode($result) }}