My script is dies at the start when I try to devine a SplFixedArray and I don't know how to find the error. Help would be appreciated...

<?
        error_reporting( E_ALL ); 
        // Initialize the array with a fixed length
        $array = new SplFixedArray(5);

Thanks!
WBR

I tried it and I had the same problem. I checked php.ini and I had the extension disabled (php_spl_types.dll) so I changed that but it still didn't work. I checked and the extension is in the Ext directory. It should work but it is still giving the same error.

Are you able to generate an error message of some kind, if so how?

Two things immediately jump to mind, are short php start tags enabled? Also are you using a version of php > 5.3.0?

In my case (since it isn't working for me either), I changed the short open tag when I tried it. I am running PHP 5.2.10 but my understanding is that it should still run.

According to PHP.net
This extension is available and compiled by default in PHP 5.0.0.
As of PHP 5.3.0 this extension can no longer be disabled and is therefore always available.

I'm running 5.2.8. I also set shorto_open_tag to Off, but that was of no value.
I am moving up to 5.3 now but as "chrishea" pointed out the docs say it should work with 5.0.0

All of the documentation indicates that SplFixedArray methods have a >= 5.3.0 requirement. Works without issue on 5.3.5 and 5.3.6 here.

PHP 5.2.11 on Win.

Defined classes prefixed with "Spl" are:

SplFileInfo
SplFileObject
SplTempFileObject
SplObjectStorage

When enabling php_spl_types extension:

SplType
SplEnum
SplBool
SplInt
SplFloat

are added.

I'm using this to get the classes:

$classes = get_declared_classes();
foreach($classes as $class) {
   if (strpos($class, 'Spl') !== false) echo $class . "\n"; 
}

It looks like 'SplFixedArray' isn't included before 5.3.0?

commented: Very logical approach to determining the answer. Good work. +10
commented: we're not worthy! +13

Digital-Ether: Your approach to determining the answer is very intelligent. Should have thought of doing something like that (but of course, I didn't!). Good work.

Digital-Ether:
Thanks for your help.

As a not so side note for me, I cannot seem to get version 5.3 of PHP running on my machine, so I will start a new note.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.