Skip to content

Instantly share code, notes, and snippets.

@fredemmott
Created February 12, 2014 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredemmott/8965518 to your computer and use it in GitHub Desktop.
Save fredemmott/8965518 to your computer and use it in GitHub Desktop.
fredemmott-mbp1:~ fredemmott$ cat test.php
<?php
$keys = array(3.141);
var_dump(array_fill_keys($keys, 'value'));
$foo = array();
$foo[3.141] = 'value';
var_dump($foo);
fredemmott-mbp1:~ fredemmott$ php test.php
array(1) {
["3.141"]=>
string(5) "value"
}
array(1) {
[3]=>
string(5) "value"
}
fredemmott-mbp1:~ fredemmott$ php --version
PHP 5.4.17 (cli) (built: Sep 12 2013 23:14:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment