After performing the following operations:
$a = array('a', 'b', 'c');
$a = array_keys(array_flip($a));
What will be the value of $a?
Suggested Answer: C
Get Premium 200-710 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
24 comments · newest first
DO
Dominga
11 months ago
I'm pretty sure it's none of the above.
CA
Carmela
11 months ago
I think it's array('c', 'b', 'a').
NG
Nguyet
11 months ago
Wait, how does that even work?
JA
Janae
11 months ago
No way, it's array('a', 'b', 'c').
MI
Millie
12 months ago
It's definitely array(2, 1, 0).
FR
Frederick
12 months ago
I'm leaning towards option C, but I feel like I might be mixing up the operations. What if it ends up being something else?
DE
Derick
1 year ago
If I remember correctly, array_flip will reverse the keys and values, so I think the final array will be in reverse order.
MA
Margurite
1 year ago
I remember practicing a similar question where array_keys was used, but I can't recall the exact order of elements after flipping.
DA
Dahlia
1 year ago
I think the array_flip function will switch the keys and values, but I'm not sure how that affects the final output.
LI
Linwood
1 year ago
I'm a bit confused on the array_flip() and array_keys() part. I'll need to review those functions before I can confidently answer this.
EL
Elly
1 year ago
I think I've got this. array_flip() creates a new array with the keys and values flipped, and then array_keys() returns the keys of that new array. So the final result should be the original array in reverse order.
EN
Enola
1 year ago
Okay, let's see. First, we create an array 'a' with 'a', 'b', and 'c'. Then we use array_flip() and array_keys() to... wait, what does that do again?
JU
Julio
1 year ago
Hmm, this looks like a tricky one. I'll need to think it through step-by-step.
MA
Madalyn
1 year ago
C'mon, this is easy! The answer is C. The original array is just returned as is after the operations.
MA
Margurite
1 year ago
I believe the answer is B) array(2, 1, 0)
VI
Vi
1 year ago
I think the answer is A) array('c', 'b', 'a')
LA
Lavonda
1 year ago
Haha, this is a classic one! I remember learning about this in my PHP class. The answer is definitely B.
FR
Francesco
1 year ago
I think the answer is A.
CI
Ciara
1 year ago
Actually, it's B. The keys will be re-indexed in reverse order.
SH
Shawnee
1 year ago
I think the answer is A.
CA
Carli
1 year ago
I think the answer is B. The array_flip() function flips the keys and values of the input array, and then array_keys() returns the keys of the resulting array.
MU
Muriel
1 year ago
Oh, I see. Thanks for clarifying.
NO
Nobuko
1 year ago
No, the correct answer is A.
JO
Joye
1 year ago
I think the answer is B.