NdArray::data

Access data as a PHP array.

Description

array NdArray::data

Return Values

A PHP array like [1, 2, 3]

Examples

Example #1: Get the data

use SciPhp\NumPhp as np;

$m np::linspace(199)->reshape(33)->power(2);

$d $m->data;

echo 
"m\n$m""data\n" print_r($dtrue);

The above example will output:

m
[[2    4    8  ]
 [16   32   64 ]
 [128  256  512]]
data
Array
(
    [0] => Array
        (
            [0] => 2
            [1] => 4
            [2] => 8
        )
    [1] => Array
        (
            [0] => 16
            [1] => 32
            [2] => 64
        )
    [2] => Array
        (
            [0] => 128
            [1] => 256
            [2] => 512
        )
)

See Also