From f212927abd87696e1a2d4cd138cd0196eba0c9e9 Mon Sep 17 00:00:00 2001 From: user52 Date: Sun, 8 Sep 2013 00:53:47 -0700 Subject: [PATCH] Add is_array_multidim() --- Curl.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Curl.class.php b/Curl.class.php index deb780d..3508454 100644 --- a/Curl.class.php +++ b/Curl.class.php @@ -98,9 +98,7 @@ class Curl { function _postfields($data) { if (is_array($data)) { - $multidimensional = !(count($data) === count($data, COUNT_RECURSIVE)); - - if ($multidimensional) { + if (is_array_multidim($data)) { $data = $this->http_build_multi_query($data); } else { @@ -169,3 +167,11 @@ class Curl { public $response_headers = NULL; public $response = NULL; } + +function is_array_multidim($array) { + if (!is_array($array)) { + return FALSE; + } + + return !(count($array) === count($array, COUNT_RECURSIVE)); +}