NumPhp::zeros

Create a new NdArray filled with zeros

Description

SciPhp\NdArray NumPhp::zeros( mixed $tuple )

Parameters

$tuple
This parameter can be an array [1, 2, 3] or a tuple of integers (1, 2, 3).

Return Values

The new SciPhp\NdArray

Examples

Example #1: Creating a new NdArray based on a shape

use SciPhp\NumPhp as np;

$x np::zeros([22]);

echo 
$x;

The above example will output:

[[0  0]
 [0  0]]

Example #2: Creating a new NdArray based on a tuple

use SciPhp\NumPhp as np;

$x np::zeros(33);

echo 
$x;

The above example will output:

[[0  0  0]
 [0  0  0]
 [0  0  0]]

See Also