Home  >  Q&A  >  body text

The variable num is not a global variable. Why can it be called by a function?

$num = 10;



##//Call function A() once;

A($ num);




#function A( $arg ){


echo $arg;


//Go inside function A and run to execute function B

B( $arg);


## echo 'We need to keep working hard until God is moved by us';


echo $arg.'<br />';

}

##function B( $number ){


## echo $number;


## echo 'I am a dog, the execution is finished<br />';


##}

小周小周2178 days ago951

reply all(4)I'll reply

  • Summer

    Summer2018-07-30 11:35:45

    Then you have to learn from the basics

    reply
    0
  • 小周

    No. .

    小周 · 2018-07-30 11:38:49
    小周

    I got it. Directly equivalent to direct A(10);

    小周 · 2018-07-30 11:46:46
  • Summer

    Summer2018-07-30 10:52:13

    You define a variable $num and then pass it as a parameter to function A without calling it.

    reply
    0
  • 小周

    What I don't understand is how the value 10 is entered.

    小周 · 2018-07-30 11:30:14
  • Cancelreply