DynamicArray::count

(Available since version 1.0)

DynamicArray::countReturns the size of the array

Description

public int DynamicArray::count ( void )

Returns the size of the array.

Note:

This method is functionally equivalent to DynamicArray::getSize().

Note:

The count of elements is always equal to the set size because all values are initially initialized with NULL.

Parameters

This function has no parameters.

Return Values

Returns the size of the array.

Examples

Example #1 DynamicArray::count() example

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

$array = new DynamicArray(5);
echo 
$array->count() . "\n";
echo 
count($array) . "\n";
?>

The above example will output:

5
5

To Top