[ create a new paste ] login | about

Link: http://codepad.org/NMc1idYX    [ raw code | output | fork | 1 comment ]

PHP, pasted on Apr 17:
1
2
3
4
5
6
7
8
9
<?php

$in = "1234";
$arr = array($in => "foobar");
$keys = array_keys($arr);
$out = $keys[0];

var_dump($in == $out);
var_dump($in === $out);


Output:
1
2
bool(true)
bool(false)


Create a new paste based on this one


Comments:
posted by spookylukey on Apr 21
Or, to put it more succinctly:

var_dump(array_keys(array("1234" => "foo"))[0]);

Output:

int(1234)

reply