ID: 19943 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Arrays related Operating System: Win2K PHP Version: 4.2.1 New Comment:
However, the following codes does work, even though the array is still ragged: <? $ragged = array(); for ( $count = 0; $count < 10; $count++ ) { $ragged['idx'][$count] = 'ragged '.$count; $ragged[$count] = 'single '.$count; } ?> <html><head></head><body> <table border="1"> <tr> <td>Expected</td><td>Actual</td> <td>Expected IDX</td><td>Actual IDX</td> </tr> <? for ( $count = 0; $count < 10; $count++ ) { ?> <tr> <td> <?= 'single '.$count ?> </td><td> <?= $ragged[$count] ?> </td> <td> <?= 'ragged '.$count ?> </td><td> <?= $ragged['idx'][$count] ?> </td> </tr> <? } ?> </table></body></html> Previous Comments: ------------------------------------------------------------------------ [2002-10-16 19:50:57] [EMAIL PROTECTED] When using an array that has ragged indices, the value in the array is undefined. Well, actually it can be defined, but it is unexpected. No errors or warnings are reported. Sample Code: <? $ragged = array(); for ( $count = 0; $count < 10; $count++ ) { $ragged[$count] = 'single '.$count; $ragged[$count]['idx'] = 'ragged '.$count; } ?> <html><head></head><body> <table border="1"> <tr> <td>Expected</td><td>Actual</td> <td>Expected IDX</td><td>Actual IDX</td> </tr> <? for ( $count = 0; $count < 10; $count++ ) { ?> <tr> <td> <?= 'single '.$count ?> </td><td> <?= $ragged[$count] ?> </td> <td> <?= 'ragged '.$count ?> </td><td> <?= $ragged[$count]['idx'] ?> </td> </tr> <? } ?> </table></body></html> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19943&edit=1