如何在php中更改数组的输出 [英] how to change the output of array in php

查看:65
本文介绍了如何在php中更改数组的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有

i有一个数组是



hi 2 all
i have an array which is

<?php
$x=array(1,2,3,4,5,6);
foreach($x as $y)
{

print_r($y);
}

?> 





以上代码输出123456



i希望输出像那样

(1,2)

(3,4)

(5,6)

怎么样?



the above code output 123456

i want the output to be like that
(1,2)
(3,4)
(5,6)
how to that??

推荐答案

X =阵列(1,2,3,4,5,6);
foreach(
x=array(1,2,3,4,5,6); foreach(


x as


y)
{

print_r(
y) { print_r(


这篇关于如何在php中更改数组的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆