PHP Constants Containing Arrays

0 votes

This fails in my case

define('DEFAULT_ROLES', array('guy', 'development team'));

Apparently, the constants cannot hold arrays. What is the workaround for this?

define('DEFAULT_ROLES', 'guy|development team');

//...

$default = explode('|', DEFAULT_ROLES);

This is kind of unnecessarily complicated to me.

Aug 5 in Others by krishna
• 2,540 points
11 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Others

0 votes
0 answers

Pound key/Hash key/hashtag in php arrays

I am working in some technology stacks ...READ MORE

Aug 1 in Others by krishna
• 2,540 points
7 views
0 votes
0 answers

How can I sort arrays and data in PHP?

These are my primary questions: How do I ...READ MORE

6 days ago in Others by krishna
• 2,540 points
16 views
0 votes
1 answer

Using unserialize in PHP throws the same error repeatedly

I googled 'Node no longer exists', and ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,240 points
822 views
0 votes
1 answer

Where is the documentation to refer for coinbase api integration of Etherium coin currency in php?

Hey there! Please refer to the following ...READ MORE

answered Jan 25, 2019 in Others by Omkar
• 69,210 points
281 views
0 votes
1 answer

Execute a shell script with php

One of the possible reason for this ...READ MORE

answered Feb 24, 2019 in Others by Omkar
• 69,210 points
5,960 views
0 votes
1 answer

Installling PHP on windows

As @Abha and @Abhi suggested, its best ...READ MORE

answered Feb 28, 2019 in Others by Anvi
• 14,170 points
329 views
0 votes
1 answer

How to check if array is multidimensional or not?

Since the 'second dimension' could be just ...READ MORE

answered Nov 5, 2018 in Others by DataKing99
• 8,240 points
3,978 views
0 votes
1 answer

How to store input value into array then localstorage?

Hello @ abhittac, You have create the array everytime the ...READ MORE

answered Jul 24, 2020 in Java-Script by Niroj
• 82,740 points
4,909 views
0 votes
1 answer

Convert a PHP object to an associative array

Start with simply typecasting the line:- $array = ...READ MORE

answered Feb 23 in PHP by Aditya
• 7,300 points
189 views
0 votes
0 answers

php var_dump() vs print_r()

What is the difference between var_dump() and print_r() in terms of ...READ MORE

May 28 in PHP by Kichu
• 19,040 points
23 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP