Reshape an array
SciPhp\NdArray
NdArray::reshape(
mixed
$tuple
)
$tuple
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
// Create a 2*3 matrix
$x = np::linspace(1, 6, 6)->reshape(2, 3);
$x->reshape(3, 2);
echo $x;
The above example will output:
[[1 2] [3 4] [5 6]]