note 129794 added to function.array-count-values

From: Date: Sun, 06 Oct 2024 07:47:35 +0000
Subject: note 129794 added to function.array-count-values
Groups: php.notes 
Request: Send a blank email to php-notes+get-221581@lists.php.net to get a copy of this message
<?php // array_count_values() unintentionally CHANGEs some numeric values of STRING type into INT type. $array_before = ['001','001','002','123']; $array_after = array_count_values($array_before); foreach ($array_after as $key => $value): if (get_debug_type($key) == 'int') var_dump($key); // int(123) endforeach; ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 180.34.133.151) ---- Manual Page -- https://php.net/manual/en/function.array-count-values.php Edit -- https://main.php.net/note/edit/129794 Del: integrated -- https://main.php.net/note/delete/129794/integrated Del: useless -- https://main.php.net/note/delete/129794/useless Del: bad code -- https://main.php.net/note/delete/129794/bad+code Del: spam -- https://main.php.net/note/delete/129794/spam Del: non-english -- https://main.php.net/note/delete/129794/non-english Del: in docs -- https://main.php.net/note/delete/129794/in+docs Del: other reasons-- https://main.php.net/note/delete/129794 Reject -- https://main.php.net/note/reject/129794 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221581) next »