×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

What will be the output of the following PHP code (3)?

24. What will be the output of the following PHP code?

<?php
function Increment(){
    static $num = 0;
    echo "$num";
    $num++;
}

Increment();
Increment();
Increment();
?>
  1. 000
  2. 111
  3. 011
  4. 012

Answer: D) 012

Explanation:

In the above code, $num is a static variable and it will be initialized once. Thus, the output would be "012".

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.