CodeIgniter Forums
Array problem codeigniter with mongoDB - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Array problem codeigniter with mongoDB (/showthread.php?tid=52575)



Array problem codeigniter with mongoDB - El Forum - 06-16-2012

[eluser]zacksyah[/eluser]
Please help me, i have a case that must be solve immediately due to strict deadline.. Sad I have an idea using preg_match or preg_split to solve this, and had tried so many way to use it but still not understand how to use it. Maybe someone could guide me, about this case so i could get more understanding about how to use preg_match or preg_split.
from this string
Code:
$temp = "{foo:bar,bar:foo},{_id:1,nama:1,nim:1}";
how to assign it to array so the result will be like this
Code:
Array
(
[0]=>foo:bar,bar:foo
[1]=>_id:1,nama:1,nim:1
)
also the second string
Code:
$temp2 = "_id:1,nama:1,nim:1";
how to assign it to array so the result will be like this
Code:
Array
(
[0] => _id
[1] => nama
[2] => nim
)
Thank you for your guidance and the help.. Smile