I have an object array built like this (output of a "var_dump()" call i sanitized for the question a bit):
sObjects:array(3) {
[0]=>
object(SObject)#1 (2) {
["type"]=>
string(9) "Course__c"
["fields"]=>
array(1) {
["Id__c"]=>
string(3) "111"
}
}
[1]=>
object(SObject)#2 (2) {
["type"]=>
string(9) "Course__c"
["fields"]=>
array(1) {
["Id__c"]=>
string(3) "222"
}
}
[2]=>
object(SObject)#3 (2) {
["type"]=>
string(9) "Course__c"
["fields"]=>
array(1) {
["Id__c"]=>
string(3) "333"
}
}
}
Now, lets say i have $id = "111"
How would i go about iterating over my object array and retrieve the array key where [id__c] has a value equal to $id?
for example in this case i would expect to get back 0.
foreach($array as $object)and again access it the same way and it didn't work (not to mention i have no idea how to get the array key in that method)