PHP code example of hugsbrugs / php-array

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

    

hugsbrugs / php-array example snippets



use Hug\HArray\HArray as HArray;

HArray::shuffle_assoc(&$array);

HArray::array_sort_by_column(&$arr, $col, $dir = SORT_ASC);

$new_array = HArray::msort($array, $key, $sort_flags = SORT_REGULAR);

$string = HArray::recursive_implode($glue, array $array, $

$new_array = HArray::object_to_array($obj);

$count = HArray::sub_count($array);

$new_array = HArray::string_to_array($text, $word_count);

$array = ['pomme', 'poire', 'fraise', 'banane'];
$array = HArray::array_insert($array, 'kiwi', 2);
Array
(
    [0] => pomme
    [1] => poire
    [2] => kiwi
    [3] => fraise
    [4] => banane
)

$array = ['pomme', 'poire', 'fraise', 'banane'];
$array = HArray::array_insert($array, ['kiwi', 'mangue'], 2);
Array
(
    [0] => pomme
    [1] => poire
    [2] => kiwi
    [3] => mangue
    [4] => fraise
    [5] => banane
)

composer