php - How to declare a variable at the bottom of the page and use its value at the top?

It maybe easy to do but I am new to php.I really need to know how to solve it.$first = $second;$second = 4;I need to pa

It maybe easy to do but I am new to php. I really need to know how to solve it.

$first = $second;

$second = 4;

I need to pass the value of $second to $first dynamically whenever it changes.

please help,

Thanks

It maybe easy to do but I am new to php. I really need to know how to solve it.

$first = $second;

$second = 4;

I need to pass the value of $second to $first dynamically whenever it changes.

please help,

Thanks

Share Improve this question asked Jan 11, 2020 at 18:36 AshurAshur 233 silver badges8 bronze badges 1
  • as I know, php will execute and process the code in logical order it will appear at runtime. You need to store the variable inside the database if you want to retrive it later. – sialfa Commented Jan 11, 2020 at 19:07
Add a comment  | 

1 Answer 1

Reset to default -1

First, your question is purely PHP, I do not see a relationship with WordPress. If you want to link the two variables, you must use what is called: Passing by reference

In your case :

$first = & $second

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744843394a4596693.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信