NdArray::size

Number of elements of an array.

Description

int NdArray::size

Return Values

A positive integer.

Examples

Example #1: Get the number of elements

use SciPhp\NumPhp as np;

$m = np::linspace(1, 9, 9)->reshape(3, 3);

$size = $m->size;

echo 
"m\n$m", "m->size=$size\n";

The above example will output:

m
[[1  2  3]
 [4  5  6]
 [7  8  9]]
m->size=9

See Also