0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

可変長の配列の行列を入れ替える方法

Posted at

概要

授業で課題で出ていて調べても対処法がなかったので残しておきます。
以下に数字がインデックスになっており、0からインデックスが始まる一般的な配列の行列変換のコードを残しておきます。

コード

function matrix_replacement($arr)
{
    $result = [];
    for ($i = 0; $i < count($arr); $i++) {
        $result[] = array_column($arr, $i);
    }
    
    return $result;
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?