Welcome Guest, Not a member yet? Register   Sign In
enums in codeigniter 4 ?
#1

I need to create enums on codeigniter 4.3.7 site (not in database) for passing enum as parameter to custom function...
In which way can I do ?

Thanks in advance!
Reply
#2

Use PHP 8.1 or later.
Create an ENUM file and put it in somewhere where PSR-4 autoloader can autoload.
https://www.php.net/manual/en/language.e...basics.php
Reply
#3

(10-03-2023, 12:29 AM)kenjis Wrote: Use PHP 8.1 or later.
Create an ENUM file and put it in somewhere where PSR-4 autoloader can autoload.
https://www.php.net/manual/en/language.e...basics.php

Any possible decision for php 8.0 ?
Reply
#4

Enum is the new feature in PHP 8.1.
https://www.php.net/manual/en/migration8...core.enums

You cannot use it with PHP 8.0.
Reply
#5

(10-03-2023, 01:30 AM)kenjis Wrote: Enum is the new feature in PHP 8.1.
https://www.php.net/manual/en/migration8...core.enums

You cannot use it with PHP 8.0.
Some external libraries supporting 8.0 too ?
Reply
#6

Use class with properties as alternative?
Reply
#7

https://packagist.org/packages/myclabs/php-enum
Reply
#8

How to Use Enums in PHP 8
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB