Hi, Josh. Thanks

 ---- En dom, 09 ago 2020 21:36:30 +0200 Josh Bruce <j...@joshbruce.dev> 
escribió ----
 > Have not tested - just catching up on emails.
 > 
 > To verify: A property defined with a default value of the global does not 
 > already do this?

In functions/methods. In some files can "inherit" gobal vars directly or simply 
"inherit" local vars of other function.

  
 > Developer need: I rarely access global variables directly - usually going 
 > through a lib or framework. When I do I would probably wrap the access in a 
 > trait or method on a class.

Some frameworks or CMS use view files in PHP like templates. 
https://platesphp.com/v3/templates/syntax/#syntax-example

In WordPress case: 
"Developers are advised to consider this a Reserved Name List, and not to 
create local variables with the same names in Plugins or Themes. Under some 
circumstances, the global variable value will be replaced by the local variable 
value, causing errors in the WordPress Core that are difficult to diagnose. "
https://codex.wordpress.org/Global_Variables

This could be avoid easily with "use vars none" on the start of each file of 
theme/plugin.

Regards

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to