开发者

Is it possible to use SplEnum in php 5.2.6?

开发者 https://www.devze.com 2023-03-23 01:58 出处:网络
I tried to use class : abstract class my_abstractEnum extends SplEnum { ... } and class my_categoryEnum extends my_abstractEnum {

I tried to use class :

abstract class my_abstractEnum extends SplEnum {
...
}

and

class my_categoryEnum extends my_abstractEnum {
...
}

and I have :

Fatal error: Class 'SplEnum' not found

I work on PHP 5.2.6. SplEnum is for php > 5.3 ? I don't see s开发者_运维技巧o in the documentation ...


SplTypes is an experimental PECL Extension. You have to install it with pecl install SPL_Types from the command line. There is no DLL for windows, so you are limited to Linux (or have to build your own).

An alternative in userland can be found in http://www.whitewashing.de/2009/08/31/enums-in-php.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号