SarkariResultess QA Bank

PHP foreach में key और value दोनों कैसे लेते हैं? की PHP best practice क्या है?

Other 0 Views Verified
PHP foreach में key और value दोनों कैसे लेते हैं? की PHP best practice क्या है? सही विकल्प चुनें और code/solution को समझें।
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified

foreach key:value in $items {}

foreach key:value in $items {}
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified Correct Answer

foreach ($items as $key => $value) {}

foreach ($items as $key => $value) {}
Additional Explanation
key => value syntax दोनों values देता है।
Verified

foreach ($items as $key, $value) {}

foreach ($items as $key, $value) {}
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified

foreach ($key => $value from $items)

foreach ($key => $value from $items)
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।