note 108801 modified in function.array-fill-keys by danbrown

From: Date: Fri, 25 May 2012 15:21:21 +0000
Subject: note 108801 modified in function.array-fill-keys by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188231@lists.php.net to get a copy of this message
<?php
$a = array("1");

var_dump(array_fill_keys($a, "test"));
?>

array(1) {
 [1]=>
 string(4) "test"
}

now string key "1" become an integer value 1, be careful. --was-- $a = array("1"); var_dump(array_fill_keys($a, "test")); array(1) { [1]=> string(4) "test" } now string key "1" become an integer value 1, be careful. http://php.net/manual/en/function.array-fill-keys.php

« previous php.notes (#188231) next »