PHP – File to Associative Array with 1 key and two values attached

Try this // file path $file=”orderdata.txt”; // REMEMBER TO MENTION THE CORRECT FILE WITH EXTENSION // open the file and get the resource handle with errors suppressed $handle = @fopen($file,’r’); // DONT USE @ while at development since it will suppress errors // array to hold our values $params = array(); if($handle) { // if … Read more

How to loop over a nested JavaScript object in jQuery? [closed]

I think you member should be like this var members = [{unit:1,name: [“AA”, “AB”],userid:[“0001″,”0002”]}, {unit:2,name: [“BA”, “BB”],userid:[“0011″,”0012”]}]; var members = [{unit:1,name: [“AA”, “AB”],userid:[“0001″,”0002”]}, {unit:2,name: [“BA”, “BB”],userid:[“0011″,”0012”]}]; members.forEach(function(v,i){ if(v.unit==1) { console.log(v.name); } });