Little php coding stuff

Iam using below code to test with some global variable. it seems that global variable cannot be compared inside a function..

why its not displaying ‘hello world’ in the output?

below is the code that iam trying.

$bool = 1;

function boo() {
    if ($bool == 1) {
        $bool = 2;
        echo 'Hello World';    

when I remove function boo(), its getting displayed ‘hello world’. may i know why it not displaying when function exists?

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.