循环PHP数组 [英] Looping through PHP arrays

查看:71
本文介绍了循环PHP数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我来自VB;访问;最近在WAMP中引入了SQL Server背景。


我有两个从MySQL记录集中填充的数组,一个用于站点Cart,另一个用于站点部门(目录),参见手册解释下面。

Hi Guys,

I''m from a VB; Access; SQL Server background recently introduced to WAMP.

I have two arrays filled from MySQL recordsets, one for the site Cart and the other for one of the site departments (catalogs) see a manual interpretation below.

展开 | 选择 | Wrap | 行号

推荐答案

关于循环代码的三个快速评论


1.查看 php手册 ,你会发现你创造的结构不是最有效率。一个更好的选择是只计算一次数组的大小并测试大小变量,如下所示:


for(
Three quick comments about your looping code

1. check the php manual, you will see that the structure you created is not the most efficient. A better option is to calculate the size of the array only once and test against the size variable like this:

for(


i = 0 ,


size = count(
size = count(


这篇关于循环PHP数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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