3 ms·
PHP; converts array('123' => 0); into array(123 => 0); Which I came across as a problem when working with mongodb as it will only except strings as keys (not s
by xd 15y ago
PHP; converts array('123' => 0); into array(123 => 0);
Which I came across as a problem when working with mongodb as it will only except strings as keys (not sure if this is enforced by PHP and/or mongo). Luckily you can create a class with numeric properties and pass that to mongodb which will then be treated as strings i.e
$array = new stdClass;
$array->{123} = 0;
- derleth 15y ago> only except strings A strange feature of the English language is that this doesn't work; you have to use 'accept' here.