PHP code example of nnssn / straw

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

    

nnssn / straw example snippets


$s->alphaList    //alpha or alpha,alpha...
$s->numList      //num or num,num...
$s->alphanumList //alphanum or alphanum,alphanum...

$s->numList('values');
access http://example.com/?values=1,2,2
//result
array
  'values' =>
    0 => 1
    1 => 2
    2 => 2

$s->alphaSet    //alpha or alpha;alpha...
$s->numSet      //num or num;num...
$s->alphanumSet //alphanum or alphanum;alphanum...

$s->numSet('values');
access http://example.com/?values=1;2;3
//result
array
  'values' =>
    0 => 1
    1 => 2
    2 => 3

//Set rule is not allow duplicate values.
access http://example.com/?values=1;2;2
//result
null