1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to use SPL classes

Discussion in 'PHP' started by vetrivel, May 17, 2010.

  1. #1
    Hi,
    I just now seen the SPl section in PHP and tried a example in my localhost.
    I return an error as class not found.
    // Initialize the array with a fixed length
    $array = new SplFixedArray(5);
    
    $array[1] = 2;
    $array[4] = "foo";
    
    var_dump($array[0]); // NULL
    var_dump($array[1]); // int(2)
    
    var_dump($array["4"]); // string(3) "foo"
    PHP:
    So I hope i need to enable some setting or else i need 2 include the class file .
    But how to do that?
    Any idea?
     
    vetrivel, May 17, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    What version of php are you using? It has been complied in php source since 5.0.

    CHeck your php.ini and make sure that spl is not disabled also.
     
    jestep, May 17, 2010 IP
  3. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,
    My PHP version is 5.2.5
    WAMP
    And i enabled the extension - php_spl_types.
    What else i need to do?

     
    vetrivel, May 17, 2010 IP