J
J
jle349252015-11-01 22:44:00
PHP
jle34925, 2015-11-01 22:44:00

PHP Why doesn't an unquoted array index work?

Why doesn't an array index without quotes work?

$sc = array('mm', 'jj', 'dd');
define('sss', 1);
echo $sc[sss];

Should input jj, but the output is empty. What module to include or what is needed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2015-11-01
@jle34925

Works, of course.
codepad.org/1UzGsUua

O
Optimus, 2015-11-01
Pyan @marrk2

Why should it work without quotes? The php syntax is...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question