如何单独访问数组元素并获取它们

时间:2013-08-29 00:11:14

标签: php arrays

print_r($que);

输出:

Array ( [0] => Array ( [0] => PHP allows you to send emails directly from a script [1] => How do you get information from a form that is submitted using the "get" method? [2] => In PHP you can use both single quotes ( ) and double quotes ( " " ) for strings: [3] => What does php stands for ? [4] => The PHP syntax is most similar to: [5] => What is the correct way to connect to a MySQL database? [6] => What is the correct way to include the file "time.inc" ? [7] => In PHP, the die() and exit() functions do the exact same thing. [8] => All variables in PHP start with which symbol? [9] => Include files must have the file extension ".inc" ) )

我需要打印每个元素。

LIKE $ que [0];和$ que [1];等等。

如果我echo "$que[0]";输出结果为Array而不是PHP allows you to send emails directly from a script

1 个答案:

答案 0 :(得分:1)

$que[0]本身就是一个数组。要访问$que第一个元素中的第一个元素,您需要执行$que[0][0]