note 129824 added to function.array-count-values

From: Date: Sat, 26 Oct 2024 09:13:24 +0000
Subject: note 129824 added to function.array-count-values
Groups: php.notes 
Request: Send a blank email to php-notes+get-221615@lists.php.net to get a copy of this message
array_count_values() CHANGEs some numeric values of STRING type to INT type keys. <?php $result_array = array_count_values(['001','001','002','83', '84', 0123]); $table = "<table>"; foreach ($result_array as $key => $value): $table .= "<tr><td>".get_debug_type($key)."({$key})<td>".get_debug_type($value)."({$value})"; endforeach; echo $table."</table>"; /* $table is like below. string(001) int(2) string(002) int(1) int(83) int(2) <-- '83' & 0123 int(84) int(1) STRING '83' and '84' was changed to INT type whereas '001' and '002' was not. */ ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 153.229.101.182) ---- Manual Page -- https://php.net/manual/en/function.array-count-values.php Edit -- https://main.php.net/note/edit/129824 Del: integrated -- https://main.php.net/note/delete/129824/integrated Del: useless -- https://main.php.net/note/delete/129824/useless Del: bad code -- https://main.php.net/note/delete/129824/bad+code Del: spam -- https://main.php.net/note/delete/129824/spam Del: non-english -- https://main.php.net/note/delete/129824/non-english Del: in docs -- https://main.php.net/note/delete/129824/in+docs Del: other reasons-- https://main.php.net/note/delete/129824 Reject -- https://main.php.net/note/reject/129824 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221615) next »