PHP code example of israelalagbe / php-custom-types

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

    

israelalagbe / php-custom-types example snippets


use IsraelAlagbe\CustomTypes\_Array;
$items = new _Array([1,2]); // or _Array(1, 2)
$items->push(4); // [1,2,4]
$items->map(function($item) {
    return $item * 2;
});  // [2, 4, 8]

echo $items;

//To get the original array, you can use
print_r($items->toArray()); // [2, 4, 8]