Malhar Lathkar

Malhar Lathkar

103 Articles Published

Articles by Malhar Lathkar

Page 3 of 11

PHP DivisionByZeroError

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

The DivisionByZeroError class is a subclass of ArithmeticError class. This type of error occurs when division operations involve a denominator value of zero. This can also occur when a modulo operator (%) has 0 as the second operand, and the intdiv() function has 0 as its second argument. Modulo Division by Zero The modulo operator (%) throws a DivisionByZeroError when the divisor is zero ? Modulo by zero Integer Division by Zero The intdiv() function also raises DivisionByZeroError when the divisor is zero ? ...

Read More

PHP ParseError

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

ParseError class extends CompileError class and is thrown when PHP code inside a string passed to the eval() function contains syntax errors. The eval() function evaluates a given string as PHP code. If the code contains syntax errors, it throws a ParseError instead of causing a fatal error. Syntax eval ( string $code ) : mixed Parameters Parameter Description code Valid PHP code to be evaluated. Must not include opening/closing PHP tags and must end with semicolon. Valid code returns NULL, while syntax errors in the ...

Read More

PHP Types of Errors

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

PHP's internal Error types are represented by classes that are inherited from Error class. The Error class implements Throwable interface and provides a structured way to handle different types of runtime errors. Error Class Properties message − The error message code − The error code file − The filename where the error happened line − The line where the error happened Error Class Methods __construct() − Construct the error object getMessage() − Gets the error ...

Read More

PHP Zip context options

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 289 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 416 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 243 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 582 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 230 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 594 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
Showing 21–30 of 103 articles
« Prev 1 2 3 4 5 11 Next »
Advertisements