PHP code example of samlitowitz / php-memory

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

    

samlitowitz / php-memory example snippets


use PhpMemory\MemoryLimit;
use PhpMemory\Unit\Binary\Megabyte;
MemoryLimit::set(Size::create(2, new Megabyte()), true);

echo init_get(MemoryLimit::INI_OPTION);
// 1M

use PhpMemory\MemoryLimit;
use PhpMemory\Unit\Byte;
MemoryLimit::set(Size::create(100, new Byte()));

echo init_get(MemoryLimit::INI_OPTION);
// 100
shell
composer