InputValidator::is_curl_handle( mixed $input ): bool

In this article

Verify whether a received input parameter is a Curl handle.

Description

The PHP Curl extension worked with resources prior to PHP 8.0 and with an instance of the CurlHandle class since PHP 8.0.
https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.resource2object

Parameters

$inputmixedrequired
Input parameter to verify.

Return

bool

Source

public static function is_curl_handle($input) {
	if (is_resource($input)) {
		return get_resource_type($input) === 'curl';
	}

	if (is_object($input)) {
		return $input instanceof CurlHandle;
	}

	return false;
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.