Is it possible to use SplEnum in php 5.2.6?

无人久伴 提交于 2019-12-30 08:21:11

问题


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 so in the documentation ...


回答1:


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



来源:https://stackoverflow.com/questions/6846395/is-it-possible-to-use-splenum-in-php-5-2-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!