PHP current() not working

Discussion in 'PHP' started by imchandan, Jul 6, 2009.

  1. #1
    Guys,
    I have one site which uses current() to get top element on array.
    It works fine on my local environment, but when i push it live, this function doesn't work.
    my array has:
    Array ( [6] => stdClass Object ( [tid] => 6 [vid] => 3 [name] => Symptoms & Diagnostics [description] => [weight] => 0 ) )
    i use current($array)->tid
    current($array) should give me stdClass Object
    Please help me out.

    Thanks,
    Chandan
     
    imchandan, Jul 6, 2009 IP
  2. imchandan

    imchandan Guest

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    Nevermind,
    I turned on this in .htaccess and it started working
    php_value zend.ze1_compatibility_mode On
     
    imchandan, Jul 7, 2009 IP
  3. aquila10

    aquila10 Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try first:
    reset($array);
    then:
    current($array);
     
    aquila10, Jul 7, 2009 IP