PHP Conference Kansai 2025

Voting

: min(four, zero)?
(Example: nine)

The Note You're Voting On

Eugene Kunkel
8 years ago
Gets a current list of all CURLE_* error constants, their applicable error messages, and their applicable error codes. Useful for making wrapper classes or for mapping cURL errors to specific Exception objects.

<?php

$list
= get_defined_constants(TRUE);
$list = preg_grep('/^CURLE_/', array_flip($list['curl']));
$result = array();

foreach (
$list as $const) {
$result[$const] = array
(
'code' => constant($const),
'message' => curl_strerror(constant($const))
);
}

echo
"<pre>";
echo
print_r($result, TRUE);
echo
"</pre>";

<< Back to user notes page

To Top