I have a simple associative array.
$a = array("a"=>"b", "c"=>"d");
I want to check if the key "1" exists in the array, e.g.
isset($a["1"]);
This string is being treated as an integer, so that
echo $a["1"]; //prints "d"
How do I get it to treat it as a string?
I don't want to use array_key_exists or in_array because my benchmarking shows isset will be a lot faster.
echo $a["1"];
doesnt print"d"
. – UpcastUndefined index: 1
as expected – Isidore