DynamicArray::getAllocatedSize

(Available since version 1.0)

DynamicArray::getAllocatedSizeGets the size of the internal array

Description

public int DynamicArray::getAllocatedSize ( void )

Gets the size that is currently allocated for use by the array.

Parameters

This function has no parameters.

Return Values

Returns the size of the internal array, as an integer.

Examples

Example #1 DynamicArray::getAllocatedSize() example

<?php
require 'vendor/autoload.php'// A PSR-4 or PSR-0 autoloader
use \SEIDS\Arrays\Dynamic\DynamicArray;

$array = new DynamicArray(5);
echo 
$array->getSize()."\n";
echo 
$array->getAllocatedSize()."\n";
$array->push(null);
echo 
$array->getSize()."\n";
echo 
$array->getAllocatedSize()."\n";
?>

The above example will output:

5
5
6
10

To Top