"10","sex"=>"nan"), ("name"=>"zs","age"=>"10","sex"=>"nan"), ("name"=>"zs","age"=>"10"">
当前位置:Gxlcms > PHP教程 > 关于二维数组。

关于二维数组。

时间:2021-07-01 10:21:17 帮助过:11人阅读

"zs","age"=>"10","sex"=>"nan"),            ("name"=>"zs","age"=>"10","sex"=>"nan"),            ("name"=>"zs","age"=>"10","sex"=>"nan"),            ("name"=>"ls","age"=>"11","sex"=>"nan"),            ("name"=>"ww","age"=>"12","sex"=>"nv"),            ("name"=>"ls","age"=>"11","sex"=>"nan"),            ("name"=>"ww","age"=>"12","sex"=>"nv"),            ("name"=>"ls","age"=>"11","sex"=>"nan"),            ("name"=>"ww","age"=>"12","sex"=>"nv")	);	echo '';	echo '';		foreach( $row as $col ){			echo '';		}		echo '';	}	echo '

数组转化为表格

'; foreach( $group as $row ){ echo '
{$col}
';?>


这样写为何不对?


回复讨论(解决方案)

这个错在第三行

	$group = array(            array("name"=>"zs","age"=>"10","sex"=>"nan"),            array("name"=>"zs","age"=>"10","sex"=>"nan"),            array("name"=>"zs","age"=>"10","sex"=>"nan"),            array("name"=>"ls","age"=>"11","sex"=>"nan"),            array("name"=>"ww","age"=>"12","sex"=>"nv"),            array("name"=>"ls","age"=>"11","sex"=>"nan"),            array("name"=>"ww","age"=>"12","sex"=>"nv"),            array("name"=>"ls","age"=>"11","sex"=>"nan"),            array("name"=>"ww","age"=>"12","sex"=>"nv")	);	echo '';	echo '';		foreach( $row as $col ){			echo "";		}		echo '';	}	echo '

数组转化为表格

'; foreach( $group as $row ){ echo '
{$col}
';

	$group = array(            array("name"=>"zs","age"=>"10","sex"=>"nan"),            array("name"=>"zs","age"=>"10","sex"=>"nan"),            array("name"=>"zs","age"=>"10","sex"=>"nan"),            array("name"=>"ls","age"=>"11","sex"=>"nan"),            array("name"=>"ww","age"=>"12","sex"=>"nv"),            array("name"=>"ls","age"=>"11","sex"=>"nan"),            array("name"=>"ww","age"=>"12","sex"=>"nv"),            array("name"=>"ls","age"=>"11","sex"=>"nan"),            array("name"=>"ww","age"=>"12","sex"=>"nv")	);	echo '';	echo '';		foreach( $row as $col ){			echo "";		}		echo '';	}	echo '

数组转化为表格

'; foreach( $group as $row ){ echo '
{$col}
';


array 一定要加么?

是的,不然怎么叫数组

如果你是在 php5.4 及以上,也可简写为:[ ]

是的,不然怎么叫数组

如果你是在 php5.4 及以上,也可简写为:[ ]


哦,感谢版主。还是用5.3的吧。太先进也不好。

人气教程排行