PHP code example of jsnlib / group

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

    

jsnlib / group example snippets

 
$ary = array('a', 'b', 'c', 'd', 'e', 'f', 'g');

$result = Jsnlib\Group::length($ary, 3);
print_r($result);

/*Array
(
    [0] => Array
        (
            [0] => a
            [1] => b
            [2] => c
        )

    [1] => Array
        (
            [0] => d
            [1] => e
            [2] => f
        )

    [2] => Array
        (
            [0] => g
        )

)*/

$result = Jsnlib\Group::each($ary, 3);
print_r($result);

/*
Array
(
    [0] => Array
        (
            [0] => a
            [1] => d
            [2] => g
        )

    [1] => Array
        (
            [0] => b
            [1] => e
        )

    [2] => Array
        (
            [0] => c
            [1] => f
        )

)
 */