PATH_TRANSLATED in PHP

Syntax string PATH_TRANSLATED Description The PATH_TRANSLATED variable contains the actual filesystem path to the file being processed.
Continue reading…

Enjoyed this post? Share it!

 
 

HTTP_USER_AGENT in PHP

Syntax string HTTP_USER_AGENT Description The HTTP_USER_AGENT variable contains the contents of the HTTP User_Agent:header if the user-agent sent it to the server. For instance, if you access this when an Internet Explorer 5.5 browser on Windows NT 4 makes a request, you get the following: echo HTTP_USER_AGENT; Output: “Mozilla/4.0 (compatible; MSIE 5.5;Windows NT 4.0)”
Continue reading…

Enjoyed this post? Share it!

 
 

Accessing global variables in PHP

There are two ways of accessing variables defined in a global scope from within a function scope. We can use the global statement or the $GLOBALS array. Example code using global statement: $a = "Namaste"; $b = "World"; function hello() { global $a, $b; echo "$a $b"; } hello(); // Displays "Namaste World" Example code […]
Continue reading…

Enjoyed this post? Share it!

 
 

PHP Truly Global Variables

A naming convention for truly global variables are in all uppercase letters generally. This allows easy identification as global variables.In general, usage of globals is bad because they can be changed anywhere, making identifying the location of bugs difficult and they also pollute the global namespace. 1 2 3 4 5 6 7 8 9 […]
Continue reading…

Enjoyed this post? Share it!