Articles on Trending Technologies

Technical articles with clear explanations and examples

PHP Zip context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 305 Views

PHP's ZIP extension provides the zip:// stream wrapper for reading files from ZIP archives. Starting from PHP 7.2.0, it supports passwords for encrypted archives through context options. Zip Context Options The ZIP wrapper supports only one context option − Option Type Description password string Password for encrypted ZIP archives Example Note: This example requires file system access to create and read ZIP files. First, create a password-protected ZIP archive − Now, read the file from the encrypted ZIP archive using context ...

Read More

PHP SSL context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 2K+ Views

SSL context options in PHP allow you to configure secure connections when using ssl:// and tls:// transports. These options control certificate verification, encryption settings, and connection security for secure network communications. SSL Context Options The following table lists all available SSL context options and their purposes ? Option Description peer_name Peer name to be used. If this value is not set, then the name is guessed based on the hostname used when opening the stream. verify_peer Require verification of SSL certificate used. Defaults to TRUE. verify_peer_name Require verification of ...

Read More

PHP Socket context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 432 Views

Access to filesystem and various other stream wrappers can be customized by context options and parameters configured by stream_context_create() and stream_context_set_option() functions. Following list shows various socket context options available for all wrappers that work over sockets, like tcp, http and ftp ? Socket Context Options Option Description bindto Specifies the IP address (either IPv4 or IPv6) and/or the port number used to access the network. (ip:port for IPv4 [ip]:port for IPv6). backlog Limits number of outstanding connections in socket's listen queue. ipv6_v6only Overrides the OS ...

Read More

PHP Phar context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 257 Views

Phar stands for PHP Archive. All the resources of a certain PHP application or library are packaged in a single .phar file for the purpose of distribution. A phar file can be used as IO stream with phar:// wrapper. Phar Context Options The phar:// wrapper supports several context options for controlling compression and metadata ? compress PHP has predefined constants for defining compression formats ? Constant Value Description Phar::NONE 0x00000000 no compression Phar::COMPRESSED 0x0000F000 bitmask to determine if any compression is present Phar::GZ 0x00001000 ...

Read More

PHP Context Parameters

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 600 Views

Context parameters allow customization of access to filesystem and other stream wrappers. To configure a stream, PHP has stream_context_set_params() function. Syntax stream_context_set_params ( resource $stream_or_context , array $params ) : bool Parameters: $stream_or_context − Any of PHP's supported streams/wrappers/contexts $params − An associative array of the structure $params['paramname'] = "paramvalue" Context Parameters notification − A user-defined callback to be called whenever a stream triggers a notification. Only for http:// and ftp:// stream wrappers. The notification callback function has the following syntax: stream_notification_callback ( ...

Read More

PHP MongoDB context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 239 Views

PHP can interact with MongoDB database through database extensions. For older versions of PHP, the mongo driver can be installed from PECL. This has now been replaced by the mongodb driver. Both drivers can be installed using precompiled binaries for Linux/Windows/MacOS operating systems. Alternatively, manual installation can be done from source tarball available on github. In either case, mongo or mongodb extension should be enabled in php.ini settings. The PHP MongoDB extension provides Stream Context Support using the mongodb context. This allows you to register callback functions that are triggered during various MongoDB operations for debugging and monitoring purposes. ...

Read More

PHP HTTP context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 616 Views

PHP HTTP context options allow you to configure HTTP and HTTPS requests when using stream functions like file_get_contents() or fopen(). These options provide control over request methods, headers, timeouts, and other HTTP-specific behaviors. Available Context Options Option Description method HTTP method supported by the remote server. Defaults to GET. header Additional headers to be sent during request. user_agent Value to send with User-Agent: header. By default the user_agent php.ini setting is used. content Additional data to be sent after the headers. Typically used with POST or PUT requests. ...

Read More

PHP FTP context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 525 Views

Context options for ftp:// transports allow you to customize FTP operations in PHP. These options control how files are transferred, whether existing files can be overwritten, and how connections are handled. Available Context Options Option Description overwrite Allow overwriting of already existing files on remote server while uploading only resume_pos File offset at which to begin transfer. Applies for downloading only. Defaults to 0 (Beginning of File) proxy Proxy FTP request via http proxy server. Applies to file read operations only. Ex − tcp://squid.example.com:8000 Example − Overwriting ...

Read More

PHP variable Variables

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 2K+ Views

In PHP, variable variables allow you to use the value of one variable as the name of another variable. This is achieved by prefixing a variable with two dollar signs ($$). This feature provides dynamic variable naming capabilities. Syntax The syntax for variable variables uses double dollar signs ? $$variable_name = value; Basic Example Here's how variable variables work with string values ? xyz abcd abcd In this example, $$var1 creates a new variable $xyz because the value of $var1 is "xyz". Limitations with ...

Read More

PHP Variables from External Sources

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 432 Views

PHP can receive data from external sources like HTML forms, cookies, and image submit buttons. This data is automatically populated into PHP's superglobal variables for easy access in your scripts. HTML Form Elements When a web page submits data through an HTML form, PHP automatically makes it available through $_POST, $_GET, and $_REQUEST variables. Here's a typical HTML form ? The PHP script can access the submitted data through the $_POST associative array ? ...

Read More
Showing 22281–22290 of 61,297 articles
Advertisements