PHP code example of inscure / collection
1. Go to this page and download the library: Download inscure/collection 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/ */
inscure / collection example snippets
$array = new Collection\Collection(array(1, 2, 3, 4, 5));
echo $array->get(4); // 5
echo count($array); // 5
foreach($array as $key => $value) {
echo $key . '=>' . $value . '<br />';
}
// 0 => 1
// 1 => 2
// 2 => 3
// 3 => 4
// 4 => 5
$array[0] = null;
foreach($array as $key => $value) {
echo $key . '=>' . $value . '<br />';
}
// 0 =>
// 1 => 2
// 2 => 3
// 3 => 4
// 4 => 5