创建无按键阵列在一个循环 [英] Creating an array without keys in a loop

查看:84
本文介绍了创建无按键阵列在一个循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个大脑放屁,因为它是一个晚一天,但我在这里卡住了。

This might be a brain fart, since it's a late day, but I'm stuck here.

我需要从一个选择框取$ _ POST值。 (这是一个数组),并将其转换为一个简单的阵列不具有任何密钥。

I need to take a $_POST value from a select box. (It's an array), and convert it to a simple array that doesn't have any keys.

下面是从项目的print_r:

Here's the print_r from the item:

阵列([0] => 19 [1] => 18 [2] => 21)

问题是,我需要一个数组,看起来像这样:

Problem is, I need an array that looks like this:

阵列(19,18,21)

每当我试图通过表单域的foreach(),我必须做这样的事情:

Whenever I try to foreach() through the form field, I have to do something like this:

$行[] = $ VAL;

但是,这给我留下了一个数字索引。

But that leaves me with a numerical index.

我是什么失踪?

感谢。

推荐答案

您不能没有密钥的阵列。

you can't have an array without keys.

Array(19,18,21)

该数组有键0,1和2。

this array has keys 0,1 and 2.

这篇关于创建无按键阵列在一个循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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