Hi guys, i'm sure you all know the unserialze() function in PHP. I need the same thing for IOS. Basically i got a string from db field which looks like this :
a:4:{i:0;s:6:"Vincent";i:1;s:14:"Julie";i:2;s:12:" Tomas";i:3;s:10:"John";}
I would like the correct function to display the above string as : Vincent, Julie, Tomas, John.
Hi guys, i'm sure you all know the unserialze() function in PHP. I need the same thing for IOS. Basically i got a string from db field which looks like this :
a:4:{i:0;s:6:"Vincent";i:1;s:14:"Julie";i:2;s:12:" Tomas";i:3;s:10:"John";}
I would like the correct function to display the above string as : Vincent, Julie, Tomas, John.
No, I don't know the PHP unserialze (unserialize?) command.
In general terms, it looks like a command that takes a variable (or object) and converts it to a byte-stream. That concept exists in Cocoa as well. However, the details are different. I doubt you'll find a ready-made way to unserialize PHP variables/objects into Objective C, since they are different languages, and their data structures and constructs are different. PHP is loosely typed, for example, which is likely to cause problems in creating Objective C equivalent structures.
You'll probably have to restrict what you put the DB fields in PHP to a specific format (or small set of possible formats), and then write Objective C code that parses that specific format into Objective C data containers.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
Thanks!! Guess what i've done is as suggested : make sure the data being serialised is in a readable format. I wanted to go the quickest route, but seems like that one was the longest but simpler!!
Thanks!! Guess what i've done is as suggested : make sure the data being serialised is in a readable format. I wanted to go the quickest route, but seems like that one was the longest but simpler!!
Thanks again
It will probably be easier to export the data in a format like JSON that is cross-platform.
You could also use a PHP implementation of property lists, like CFPropertyList
Binary property lists are a whole lot faster and more efficient than text-based formats like JSON (or worse yet XML)
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.