PHP code example of linuscash / with-global-state
1. Go to this page and download the library: Download linuscash/with-global-state 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/ */
linuscash / with-global-state example snippets
function greetMe (String $moniker): String
{
return "Hello {$moniker} my name is {$GLOBALS['name']}";
}
greetMe('stranger'); // ??
$linusGreetMe = withGlobalState('greetMe', ['name' => 'Linus']);
$linusGreetMe('stranger'); // "Hello stranger my name is Linus"