note 129587 added to function.array-is-list
| From: | theking32(at)king.ma | Date: | Fri, 14 Jun 2024 19:38:01 +0000 |
| Subject: | note 129587 added to function.array-is-list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221378@lists.php.net to get a copy of this message | ||
This function can distinguish between a vector and a associative array (dictionary)
<?php
$a = ['a','b','a'];
$b = ['a'=>'one','b'=>'two','c'=>3];
echo (array_is_list($a)?'true':'false') . '<br>';
echo (array_is_list($b)?'true':'false') . '<br>';
?>
returns
true
false
as the first is a vector and the second is an associative array.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 185.159.157.11)
----
Manual Page -- https://php.net/manual/en/function.array-is-list.php
Edit -- https://main.php.net/note/edit/129587
Del: integrated -- https://main.php.net/note/delete/129587/integrated
Del: useless -- https://main.php.net/note/delete/129587/useless
Del: bad code -- https://main.php.net/note/delete/129587/bad+code
Del: spam -- https://main.php.net/note/delete/129587/spam
Del: non-english -- https://main.php.net/note/delete/129587/non-english
Del: in docs -- https://main.php.net/note/delete/129587/in+docs
Del: other reasons-- https://main.php.net/note/delete/129587
Reject -- https://main.php.net/note/reject/129587
Search -- https://main.php.net/manage/user-notes.php