|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-06-25 18:56 UTC] bretschneider at freestyling dot de
<?
$A[1] = 'A';
$A[2] = 'B';
$A[3] = 'C';
$DUMP = array_pop($A);
for ($i=0; $i<=sizeof($A); $i++) {
print "$i = ".$A[$i]."<br>\n";
}
?>
returns:
0 = A
1 = B
2 =
but should return
0 =
1 = A
2 = B
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Thats kinda bs. for ($i=0; $i<=sizeof($A); $i++) { print "$i = ".$A[$i]."<br>\n"; } ?> returns: 0 = A 1 = B 2 = but should return 0 = 1 = A 2 = B i think you misunderstand what he is saying. the for loop he created to dump the array is adding the "2 = " what woudl be displyed in a var_dump or print_r would be Array( [0]=>A,[1]=>B) when it should be Array( [1]=>A,[2]=>B) since the original displays Array ( [1] => A [2] => B [3] => C )