Hey.

Is there a global object in PHP , in which all the built-in methods lie, all user functions, objects, variables ..., within which PHP programming itself takes place? In javascript, such an object is a window object.

I want to figure out what PHP programming is. For example, for comparison, programming in javascript is the manipulation of the "leaves" -objects of the BOM tree - "Take one leaf-object of the BOM tree, do something with it, write the result into another sheet-object ...".

  • Not. You can not prokidyvat principles of work from one language to another. This is the right way to bydlokodingu. - user207618
  • you have some kind of porridge in your head, sorry. I do not even know what to advise. - rjhdby
  • there is no porridge. so don't apologize - Dimon
  • In general, there is no window in JavaScript. In the JS implementation in browsers, yes, there is, but this is not all JavaScript. - Yaant
  • window is not in ECMAScript, and JavaScript is ECMAScript + browser. so there is a window in javascript. JavaScript is ECMAScript implementation in the browser - Dimon

1 answer 1

There are super global variables such as $ _GET, $ _POST, $ _SERVER, $ _SESSION, $ _COOKIE, etc. but it is impossible to compare two languages ​​because:

  1. js is a functional language, php is more procedural
  2. js (the one you worked with) is running in a browser, php is on the server
  3. js - you operated a DOM tree (and not a BOM symbol), php - does not operate a DOM tree, it generates markup
  4. js - multithreaded, php - single threaded
  • 2
    There is no multithreading in JavaScript. There is some kind of emulation and something like that - Alexey Shimansky
  • in javascript it is possible to work not only with a DOM tree. for example, I write var x = 10; - in the BOM tree, a "leaf" is added - the property x, which refers to the primitive value 10. In javascript 3 trees are - BOM, DOM, CSSOM. - Dimon
  • okay DOM and CSSOM understand that they have a tree structure, but I doubt that BOM has. Although I am not selen in js @Dimon - Naumov
  • @ AlekseyShimansky Yes, we will say more precisely asynchrony ie implementation of parts of the program in parallel. I think it will be more literate. - Naumov
  • BOM is a tree with a window root, into which DOM, CSSOM, user variables, user functions, built-in functions, and a whole bunch are intertwined - Dimon