SarkariResultess QA Bank

PHP anonymous function कैसे बनाते हैं? production project में safely कैसे use करें?

Other 0 Views Verified
PHP anonymous function कैसे बनाते हैं? production project में safely कैसे use करें? सही विकल्प चुनें और code/solution को समझें।
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified

$fn = anonymous($x) {}

$fn = anonymous($x) {}
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified Correct Answer

$fn = function($x) { return $x * 2; };

$fn = function($x) { return $x * 2; };
Additional Explanation
Anonymous function function(...) syntax से बनता है। Production में logging और safe error handling रखें।
Verified

$fn = lambda($x) => $x*2;

$fn = lambda($x) => $x*2;
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified

function => $fn($x) {}

function => $fn($x) {}
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।