I have written a web page that works fine expect for some weird behavior. The code below gets all expected values and populates them correctly except for $v-data["quick_phone_id"] and $v-data["quick_email_id"] which are integers. Those values come out blank in the string I am creating. The value for $v-data["id"] is another integer and works as expected.
My only clue is that when I uncomment the commented out line, the code works properly. So I'm guessing this has to do with referencing getting broken for the array. Any ideas? I'd like to fix my code and my PHP knowledge.
$contacts = ContactInfo::loadMyContacts($userId);
$sb = new StringBuilder();
$idx = 0;
//$vals = "vals: ".$contacts[0]->data["quick_phone_id"];
$sb->append(' dataRows = [');
foreach($contacts as $k => $v) {
$sb->append('{ id:"'.strval($v->data["id"]).'",');
$sb->append('url:"edit_contact.php?id='.$v->data["id"].'",');
$sb->append('gname:"'.$v->data["given_name"].'",');
$sb->append('fname:"'.$v->data["family_name"].'",');
$sb->append('phone1id2:"'.strval($v->data["quick_phone_id"]).'",');
$sb->append('phone1type:"'.$v->data["quick_phone_type"].'",');
$sb->append('phone1:"'.$v->data["quick_phone"].'",');
$sb->append("email1id2:'".strval($v->data["quick_email_id"])."',");
$sb->append('email1type:"'.$v->data["quick_email_type"].'",');
$sb->append("email1:'".$v->data["quick_email"]."',");
$sb->append("dirty:false },\n");
}
$sb->append('];');