search

Home  >  Q&A  >  body text

There is a problem with global variables in PHP development basic tutorial

The same code outputs 11 when tested locally, but the output of the web page editor is 6

Alex.HeAlex.He2295 days ago1600

reply all(2)I'll reply

  • PHPz

    PHPz2018-08-31 15:16:55

    This article written by our teacher can solve your problem: What are the changes in the global variable mechanism under PHP5 and PHP7 versions?

    reply
    0
  • PHPz

    The reason why different operation results appear is actually because in the latest php7 version, the PHP global variable processing mechanism has been modified. In this version, the global keyword can now only refer to simple variables.

    PHPz · 2018-08-31 15:17:58
  • Cancelreply