PHP code example of jdwx / param

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

    

jdwx / param example snippets




declare( strict_types = 1 );

adline( "Enter an integer: " );
if ( $st === false ) {
    echo "No input\n";
    exit( 1 );
}

try {
    $p = new Parameter( $st );
    $i = $p->asInt();
    echo "You entered: {$i}\n";
} catch ( TypeError $e ) {
    echo "ERROR: ", $e->getMessage(), "\n";
}