{"id":5657041,"date":"2015-01-10T19:03:03","date_gmt":"2015-01-10T19:03:03","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/globals\/"},"modified":"2016-08-22T15:16:25","modified_gmt":"2016-08-22T15:16:25","slug":"globals","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/globals\/","title":{"rendered":"globals?"},"content":{"rendered":"<p>The &#8220;global&#8221; keyword doesn&#8217;t seem to work.<\/p>\n<pre><code>[insert_php]\n$name = &#039;Mary&#039;;\nfunction showName()\n{\n\tglobal $name;\n\t echo &#039;My name is &#039; . $name;\n}\nshowName();\n[\/insert_php]<\/code><\/pre>\n<p>This just prints &#8220;My name is&#8221;. In this simple case, I could pass the name as a parameter, but if it&#8217;s a large variable and I&#8217;m calling the function numerous times it&#8217;s pretty inefficient.<\/p>\n<p>https:\/\/wordpress.org\/plugins\/insert-php\/<\/p>\n","protected":false},"template":"","class_list":["post-5657041","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5657041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5657041\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5657041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}