ajoo Posted August 4, 2019 Share Posted August 4, 2019 Hi all ! is there a difference between an array of arrays as rs1 = [ [1,5,6,7,8,9], [ 2,7,6,5,4,3], [3,12,13,14,15,16] ]; and another formed as below as var rs1 = "1,5,6,7,8,9 2,7,6,5,4,3 3,12,13,14,15,16"; rs1 = rs1.split(" "); //alert(rs1[0]); //alert(rs1[1]); //alert(rs1[2]); //alert(rs1.length); if so, can someone explain what the difference is. Thank you ! Quote Link to comment https://forums.phpfreaks.com/topic/309060-same-arrays-or-not/ Share on other sites More sharing options...
Barand Posted August 4, 2019 Share Posted August 4, 2019 You need to learn the difference between arrays and strings. The first is an array of arrays, the second is an array of strings containing numbers and commas Array ( [0] => Array ( [0] => 1 [1] => 5 [2] => 6 [3] => 7 [4] => 8 [5] => 9 ) [1] => Array ( [0] => 2 [1] => 7 [2] => 6 [3] => 5 [4] => 4 [5] => 3 ) [2] => Array ( [0] => 3 [1] => 12 [2] => 13 [3] => 14 [4] => 15 [5] => 16 ) ) Array ( [0] => 1,5,6,7,8,9 [1] => 2,7,6,5,4,3 [2] => 3,12,13,14,15,16 ) 1 Quote Link to comment https://forums.phpfreaks.com/topic/309060-same-arrays-or-not/#findComment-1568856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.