PHP如何将 不定个数一维数组('A','女',21), ('B','男',23), ('C','男',24)……组合成一个二维数组?

结果为('A','女',21),('B','男',23),   ('C','男',24)



慕仔0165656
浏览 1606回答 4
4回答

天使之翼死神之镰

header("content-type:text/html;charset=utf-8");$mysqli=new mysqli("localhost","root", "","test");if($mysql->connect_errno){    die("connect error:".$mysqli->connect_error);}$mysqli->set_charset('utf8');$sql = "SELECT id,username,age FROM user";$mysqli_result= $mysqli->query($sql); //返回值在$mysqli_result中,$mysqli->query()只能读取一个记录循环显示while($row = $mysqli_result->fetch_assoc()){$rows[] = $row;//二维数组}$mysqli_result->free();$mysqli->close();$rows数组就是你想要的二维数组

千机剑

<?phpheader("Content-Type:text/html; charset=utf-8");$arr=array(    "('A','女',21)",    "('B','男',23)",    "('C','男',24))");$a=array(    $arr);print_r($a);?> 

慕的地8582982

TOORBYVZFMQMCVFZNXARRFXDDSIRDRBBFJCCWFGUHYSZKUARRSYYPQLTDAOICFCZJNEHGNHZAHLFMZTMANFPGNHJZPKKABTXRHLPYINQRKFWEFZIPDRUPCTTKGJCZQUPCZZTLFGJAKRMPZPHHAUFGDEOGRCMFTJLTTQRRBHUXDKNGWDQYRLVSDAAJDKFILYBAUOEHXEQKCCJDXQEHJPWNDMYOELVWFIBROEBEBUTZHNKXNYYVFDPPIIMURTQQPCLIIDKKNCIYRYBFELFIPSXSVSCCFZJGCJGXURESIBPCVYBOFSISFMJADSMKQQYBLORHYPJDUXNQXFMCSFCPPPERATKLUAYPYFVRCROLOKEHUHATJJKKDDUXCCEUSOBBCCZVUDUKHFCFCZWQPSBSZFMPCWMGMSRROOOLRUXMCZRVICZGKRUUMGJWTXDNGJKBVVPYFIBGPPWCPWJQJNJGWNUXBKPMMFHNOYLBOLOSTSPSSGDNAEJCIPZDUKANRBNAXNXYYIVAPLYBLYSYILYTWFMFQXDDYVQJSFVGWKUBUGWZGDHHXHMZURKFFCNTGKNUHTQHUUBAXEZSZVVZCGPWWPYYDAVHVYVYWJSTZTDNMJGOHKXDQLJPCPLOYVZGJZPCZSFYZPVLVERLVBIWFBOFSVSIIFWMJMGAHKSBSSZKAUKNDXBBHHANZQMICMEOOHRGXATANZMSIVHEONTXUAAHAKNWSFOCQQXHHGDPEXVIIIYYEKANWYIYECYOMSASYMSSIQJMFHDXKENFPFLVDIHZCIBOYUACJZPCFMSCSRWSHCWULLYVRJIDHPSLHNKQMCBBHNKAQWSCLBRBIHEUKHPSQKQTPFCOELNBVGDZCVSYBBILLHOVFRH

qq_歲月靜好不忘初心_0

<?php header("Content-Type:text/html; charset=utf-8"); $A=('A','女',21); $B=('B','男',23); $C=('C','男',24)); $arr=array(     $A,     $B,     $C ); print_r($arr); ?>

好人二狗

你说的不是很清楚啊,什么形式的二维数组
打开App,查看更多内容
随时随地看视频慕课网APP