假设我有$rows = 4,并且$cols = 4;,如何以螺旋顺序创建包含16个元素的数组,例如:
$rows = 4
$cols = 4;
1, 2, 3, 4, 12,13,14,5, 11,16,15,6, 10,9, 8, 7,
php arrays
arrays ×1
php ×1