What will be printed?$a = array();if ($a[1]) null;echo count($a)?A. 0 - ProProfs Discuss
Topics
Products
Follow Us:

What will be printed?$a = array();if ($a[) null;echo count($a)?
A. 0
B. 1
C. 2
D. This code wont compile

Asked by Henry, Last updated: May 21, 2020

+ Answer
Request

4 Answers

reedyseth

Like I said, this code won't compile. See

https://sandbox.onlinephpfunctions.com/code/eff4f5c0fc4f654dee04f83912c0ce7b3752005d

Please check your quiz answer correctly, in your results you say that the correct answer is 0, which is not.
 

reedyseth

It will throw an error for Undefined offset. You are asking the second parameter in an empty array.
 

John Adney

It will throw an error for array out of index. You are asking the second parameter in an empty array.
 

John Smith

John Smith

Answered Sep 09, 2016

0
Checking value in if() does not create an array element
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.