note 74317 added to function.is-array

From: Date: Wed, 04 Apr 2007 23:32:05 +0000
Subject: note 74317 added to function.is-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-125101@lists.php.net to get a copy of this message
Yet another associative array test: function binary_nand ($a, $b) { return !$a && !$b; } function binary_nor ($a, $b) { return !$a || !$b; } // Returns true if array has elements with non-numeric keys function is_associative_array ($arr) { return is_array($arr) && !empty($arr) && array_reduce(array_map("is_numeric", array_keys($arr)), "binary_nor", true); } // Returns true if all elements of array have a non-numeric key function is_strict_associative_array ($arr) { return is_array($arr) && !empty($arr) && array_reduce(array_map("is_numeric", array_keys($arr)), "binary_nand", false); } ---- Server IP: 69.39.81.135 Probable Submitter: 72.1.94.35 ---- Manual Page -- http://www.php.net/manual/en/function.is-array.php Edit -- https://master.php.net/note/edit/74317 Del: integrated -- https://master.php.net/note/delete/74317/integrated Del: useless -- https://master.php.net/note/delete/74317/useless Del: bad code -- https://master.php.net/note/delete/74317/bad+code Del: spam -- https://master.php.net/note/delete/74317/spam Del: non-english -- https://master.php.net/note/delete/74317/non-english Del: in docs -- https://master.php.net/note/delete/74317/in+docs Del: other reasons-- https://master.php.net/note/delete/74317 Reject -- https://master.php.net/note/reject/74317 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125101) next »