NdArray::ravel

Flatten an array

Description

SciPhp\NdArray NdArray::ravel()

Parameters

This function has no parameters.

Return Values

The new SciPhp\NdArray

Examples

Example #1: Flatten a 3 dimensional array

use SciPhp\NumPhp as np;

$x = np::ar(
  [[[
1, 2, 3], 
    [
4, 5, 6],
    [
7, 8, 9] ]]
);

echo 
$x->ravel();

The above example will output:

[1  2  3  4  5  6  7  8  9]

See Also