Announcement

Collapse
No announcement yet.

Php array handling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Php array handling

    Between php 4.3.2 and 4.3.3, php's handling of array elements with negative values changed, so that the following code:
    PHP Code:
    $a[-1] = 10;
    $a['-1'] = 20;
    $a[1] = 50;
    $a['1'] = 60;
    print_r($a); 
    will print out three values (10,20,60) with earlier versions and two values (20,60) with later versions.

    Am I missing something - the string and the integer format assignments should be equivalent, as per the new handling? I don't see aloud explanation of this in the change log at php.net

    This has a bearing on how one codes arrays.
    Andrew

  • #2
    See (as mentioned in the 4.3.3 release notes): http://bugs.php.net/bug.php?id=21918

    Also read: http://www.php.net/manual/en/language.types.array.php
    Want to take your board beyond the standard vBulletin features?
    Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

    Comment


    • #3
      Originally posted by MarcoH64
      Thanks, Marco. Clear explanation, provided one knows where to look.
      Andrew

      Comment


      • #4
        Well you already said it was changed between 4.3.2 & 4.3.3, so i just looked in the release notes.
        Want to take your board beyond the standard vBulletin features?
        Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X