Malhar Lathkar has Published 189 Articles

PHP data://

Malhar Lathkar

Malhar Lathkar

Updated on 22-Sep-2020 10:37:59

153 Views

IntroductionThe data URI scheme has been defined in RFC 2397, published in 1998. It provides a mechanism to include in-line data in web page as if it is an external resource. PHP provides data:// wrapper for data URI representation. The data URI is represented as per following syntaxdata:// syntaxdata:[media type][;base64], ... Read More

PHP $http_response_header

Malhar Lathkar

Malhar Lathkar

Updated on 22-Sep-2020 10:33:27

450 Views

IntroductionThe superglobal $http_response_header array is populated by HTTP response headers as is the case with get_headers() functions. This array is created in local space of PHP$http_response_headerExampleOutputBrowser will display result similar to following0=>HTTP/1.1 302 Found 1=>Date: Tue, 08 Sep 2020 14:49:24 GMT 2=>Server: Apache/2.4.41 (Win64) OpenSSL/1.0.2s PHP/7.1.32 3=>X-Powered-By: PHP/7.1.32 4=>Location: http://localhost/dashboard/ 5=>Content-Length: 0 ... Read More

PHP $_REQUEST

Malhar Lathkar

Malhar Lathkar

Updated on 22-Sep-2020 10:32:06

155 Views

IntroductionBy default, t he superglobal variable $_REQUEST associative array is collection of contents of $_GET, $_POST and $_COOKIE variables. Settings in php.ini file decide composition of this variable. One of the directives in php.ini is request_order, which decides order in which PHP registers GET, POST and COOKIE variables. The presence and ... Read More

PHP $_POST

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:20:26

1K+ Views

Introduction$_POST is a predefined variable which is an associative array of key-value pairs passed to a URL by HTTP POST method that uses URLEncoded or multipart/form-data content-type in request.$HTTP_POST_VARS also contains the same information, but is not a superglobal, and now been deprecated.Easiest way to send data to server with POST ... Read More

PHP $_FILES

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:14:49

20K+ Views

IntroductionThe global predefined variable $_FILES is an associative array containing items uploaded via HTTP POST method. Uploading a file requires HTTP POST method form with enctype attribute set to multipart/form-data.$HTTP_POST_FILES also contains the same information, but is not a superglobal, and now been deprecatedThe _FILES array contains following properties −$_FILES['file']['name'] - ... Read More

PHP $_ENV

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:13:43

5K+ Views

Introduction$_ENV is another superglobal associative array in PHP. It stores environment variables available to current script. $HTTP_ENV_VARS also contains the same information, but is not a superglobal, and now been deprecated.Environment variables are imported into global namespace. Most of these variables are provided by the shell under which PHP parser ... Read More

PHP $_COOKIE

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:11:04

697 Views

IntroductionThe superglobal $_COOKIE stores variables passed to current script along with HTTP request in the form of cookies.$HTTP_COOKIE_VARS also contains the same information, but is not a superglobal, and now been deprecated.What is a cookie?Cookies are text files stored by a server on the client computer and they are kept of ... Read More

PHP $argv

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:09:24

3K+ Views

IntroductionWhen a PHP script is run from command line, $argv superglobal array contains arguments passed to it. First element in array $argv[0] is always the name of script. This variable is not available if register_argc_argv directive in php.ini is disabled.$argvFollowing script is executed from command line.Example Live DemoOutputarray(1) {    [0]=>   ... Read More

PHP $argc

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:08:10

338 Views

IntroductionThis superglobal variable is available when a PHP script is run from command line (and not when executed from HTTP server's document root). It is an integer that corresponds to number of command line arguments passed to current script. As script's filename has to be entered in command line, minimumn ... Read More

PHP WeakReference class

Malhar Lathkar

Malhar Lathkar

Updated on 21-Sep-2020 12:06:26

285 Views

IntroductionWith Weak references, it is possible to retain a reference to an object which does not prevent the object from being destroyed. Implementing cache like structures can be done by Weak reference.A weak reference is similar to a normal reference, except that it doesn’t prevent the garbage collector from collecting ... Read More

Advertisements