|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
>>>>> "KF" == Kevin Falcone <kevinfal@seas.upenn.edu> writes:
KF> For those of us still curious about php arrays, I did the
KF> following experiment.
This reminded me to try my experiment:
code:
<?
$fruits = array();
$fruits[0] = 'red';
$fruits[1] = 'yellow';
$fruits['0'] = 'green';
echo "\$fruits is " . sizeof($fruits) . " elements long<br />";
for ($i = 0; $i < sizeof($fruits); $i++) {
echo "element $i of \$fruits is $fruits[$i] <br />";
}
while ($x = each($fruits)) {
echo "element $x[0] of \$fruits is $x[1] <br />";
}
?>
results:
$fruits is 2 elements long
element 0 of $fruits is green
element 1 of $fruits is yellow
element 0 of $fruits is green
element 1 of $fruits is yellow
Which seems to imply (along with Kevin's results):
1) php's arrays are purely associative
2) all keys to arrays are stringified
-R
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
- References:
- php arrays
- From: Kevin Falcone <kevinfal@seas.upenn.edu>
|
|