{"id":66,"date":"2023-01-05T05:09:21","date_gmt":"2023-01-05T05:09:21","guid":{"rendered":"https:\/\/www.cmsgalaxy.com\/blog\/?p=66"},"modified":"2023-01-05T05:09:21","modified_gmt":"2023-01-05T05:09:21","slug":"php-hypertext-pre-processor","status":"publish","type":"post","link":"https:\/\/www.cmsgalaxy.com\/blog\/php-hypertext-pre-processor\/","title":{"rendered":"PHP (Hypertext Pre Processor)"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>What is PHP:<\/strong><\/p>\n\n\n\n<p>It is hypertext preprocessor. The scripts are used on the server. PHP file consists of HTML, CSS, JavaScript and PHP code. The extension of PHP is .php.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>What can PHP do?<\/strong><\/p>\n\n\n\n<p>PHP cand generate dynamic page content. It can create, open,read, write, delete and close the files.  Php can be used to control user access.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP can be accessed on different platforms like windows, linux etc<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size\"><strong>PHP variables:  <\/strong>Variables can be declared anywhere in the script. The scope of the variable is it can be referenced or used.<\/p>\n\n\n\n<p>There are three types of variables scope where it can be referred to. They are<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>local: The variables declared within the function are called local variables. These variables cannot access the outside the function.<\/li>\n\n\n\n<li>global: The variables declared outside the function are called global variables. These variables only access outside the function.<\/li>\n\n\n\n<li>static: The static is used when one need a variable to use multiple times and this function makes the variable not to delete the variable from the variable array.<\/li>\n<\/ol>\n\n\n\n<p class=\"has-medium-font-size\"><strong>PHP Superglobals:<\/strong>  <\/p>\n\n\n\n<p>These are predefined variables which can be accessed from anywhere in the script i.e from any function, class, file. <\/p>\n\n\n\n<p>There are some superglobals:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>$globals: These are variables which are available in all scopes. These can be utilized from every function, class, file. PHP stores all variables in an array called index.<\/li>\n\n\n\n<li>$<\/li>\n<\/ol>\n\n\n\n<p>The supergloabals are<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>$globals: These superglobal is variable which can be accessed from any function, class, file.<\/li>\n<\/ol>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Pavaniysk\/768978449a1365c70aa9f49aa36cade6.js\"><\/script>\n\n\n\n<p>2) $_server: This variable holds the information about header, path, and about the script location. <\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Pavaniysk\/9c63194a3dbe82312ac31a62765c68d5.js\"><\/script>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Element\/Code<\/th><th>Description<\/th><\/tr><tr><td>$_SERVER[&#8216;PHP_SELF&#8217;]<\/td><td>Returns the filename of the currently executing script<\/td><\/tr><tr><td>$_SERVER[&#8216;GATEWAY_INTERFACE&#8217;]<\/td><td>Returns the version of the Common Gateway Interface (CGI) the server is using<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_ADDR&#8217;]<\/td><td>Returns the IP address of the host server<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_NAME&#8217;]<\/td><td>Returns the name of the host server (such as www.w3schools.com)<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_SOFTWARE&#8217;]<\/td><td>Returns the server identification string (such as Apache\/2.2.24)<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_PROTOCOL&#8217;]<\/td><td>Returns the name and revision of the information protocol (such as HTTP\/1.1)<\/td><\/tr><tr><td>$_SERVER[&#8216;REQUEST_METHOD&#8217;]<\/td><td>Returns the request method used to access the page (such as POST)<\/td><\/tr><tr><td>$_SERVER[&#8216;REQUEST_TIME&#8217;]<\/td><td>Returns the timestamp of the start of the request (such as 1377687496)<\/td><\/tr><tr><td>$_SERVER[&#8216;QUERY_STRING&#8217;]<\/td><td>Returns the query string if the page is accessed via a query string<\/td><\/tr><tr><td>$_SERVER[&#8216;HTTP_ACCEPT&#8217;]<\/td><td>Returns the Accept header from the current request<\/td><\/tr><tr><td>$_SERVER[&#8216;HTTP_ACCEPT_CHARSET&#8217;]<\/td><td>Returns the Accept_Charset header from the current request (such as utf-8,ISO-8859-1)<\/td><\/tr><tr><td>$_SERVER[&#8216;HTTP_HOST&#8217;]<\/td><td>Returns the Host header from the current request<\/td><\/tr><tr><td>$_SERVER[&#8216;HTTP_REFERER&#8217;]<\/td><td>Returns the complete URL of the current page (not reliable because not all user-agents support it)<\/td><\/tr><tr><td>$_SERVER[&#8216;HTTPS&#8217;]<\/td><td>Is the script queried through a secure HTTP protocol<\/td><\/tr><tr><td>$_SERVER[&#8216;REMOTE_ADDR&#8217;]<\/td><td>Returns the IP address from where the user is viewing the current page<\/td><\/tr><tr><td>$_SERVER[&#8216;REMOTE_HOST&#8217;]<\/td><td>Returns the Host name from where the user is viewing the current page<\/td><\/tr><tr><td>$_SERVER[&#8216;REMOTE_PORT&#8217;]<\/td><td>Returns the port being used on the user&#8217;s machine to communicate with the web server<\/td><\/tr><tr><td>$_SERVER[&#8216;SCRIPT_FILENAME&#8217;]<\/td><td>Returns the absolute pathname of the currently executing script<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_ADMIN&#8217;]<\/td><td>Returns the value given to the SERVER_ADMIN directive in the web server configuration file (if your script runs on a virtual host, it will be the value defined for that virtual host) (such as someone@w3schools.com)<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_PORT&#8217;]<\/td><td>Returns the port on the server machine being used by the web server for communication (such as 80)<\/td><\/tr><tr><td>$_SERVER[&#8216;SERVER_SIGNATURE&#8217;]<\/td><td>Returns the server version and virtual host name which are added to server-generated pages<\/td><\/tr><tr><td>$_SERVER[&#8216;PATH_TRANSLATED&#8217;]<\/td><td>Returns the file system based path to the current script<\/td><\/tr><tr><td>$_SERVER[&#8216;SCRIPT_NAME&#8217;]<\/td><td>Returns the path of the current script<\/td><\/tr><tr><td>$_SERVER[&#8216;SCRIPT_URI&#8217;]<\/td><td>Returns the URI of the current page<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>3) $_post: This variable is used to collect form data after HTML form with method=post. This is used to pass variables.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Pavaniysk\/4f1b0786e8c7e43331416f17fafd975d.js\"><\/script>\n\n\n\n<p>4) $_request: This variable is used to collect data after submitting the form.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Pavaniysk\/c089290f16de345c55672747bb1c2266.js\"><\/script>\n\n\n\n<p>5) $_get: This variable is used to collect the data after submitting form. It can collect the data sent in an URL,<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is PHP: It is hypertext preprocessor. The scripts are used on the server. PHP file consists of HTML, CSS,<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":2,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/posts\/66\/revisions\/69"}],"wp:attachment":[{"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cmsgalaxy.com\/blog\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}