zohab Posted October 22, 2009 Share Posted October 22, 2009 Hi, I have following information with me 1. a.18.4687712,73.8830701 b.address1 c.images/refresh.gif 2. a.18.4708117,73.9065883 b.address2 c.images/plus_inline.gif 3. a.18.4857608,73.8962994 b.address3 c.images/plus.gif Using above information I want to create array in following format. {"markers": [ { "point":new GLatLng(18.4687712,73.8830701), "homeTeam":"address1", "markerImage":"images/refresh.gif", }, { "point":new GLatLng(18.4708117,73.9065883), "homeTeam":"address2", "markerImage":"images/plus_inline.gif", }, { "point":new GLatLng(18.4857608,73.8962994), "homeTeam":"address3", "markerImage":"images/plus.gif", }, ] } Quote Link to comment https://forums.phpfreaks.com/topic/178571-creating-new-array/ Share on other sites More sharing options...
Mchl Posted October 22, 2009 Share Posted October 22, 2009 An array or JSON string (that's what you posted)? Quote Link to comment https://forums.phpfreaks.com/topic/178571-creating-new-array/#findComment-941727 Share on other sites More sharing options...
zohab Posted October 22, 2009 Author Share Posted October 22, 2009 Yes json string $build_array=json string Following need to echo json string echo json_encode($build_array); Quote Link to comment https://forums.phpfreaks.com/topic/178571-creating-new-array/#findComment-941728 Share on other sites More sharing options...
trq Posted October 22, 2009 Share Posted October 22, 2009 I have following information with me And where exactly is this information coming from? Care to share some code? Quote Link to comment https://forums.phpfreaks.com/topic/178571-creating-new-array/#findComment-941752 Share on other sites More sharing options...
zohab Posted October 22, 2009 Author Share Posted October 22, 2009 okay Quote Link to comment https://forums.phpfreaks.com/topic/178571-creating-new-array/#findComment-941759 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.