how to deserialize an array?

  • Thread starter Thread starter Messer
  • Start date Start date
M

Messer

hello,

is there a way to deserialize the array:
a:2:{i:0;s:8:"element0";i:1;s:8:"element1";}
in vb. net?

greets,
messer
 
Take a look at this web site...

http://abstractvb.com/code.asp?F=1&P=2&A=1018

It has a great article on how to serialize and deserialize and object. They
use a custom class but doing an array is no different. I use this exact same
code to do hashtables and such. An array is no different. Also, you don't
say if you want it to be deserialized form a file or a memory stream. That
is no mater either since you can replace the filestream form the example to
a memory stream and get the same effect.
 
hello ray,
Also, you don't say if you want it to be deserialized form a file or a
memory stream.

i have this serialized array assigned to a variable "str" . (dim str as
string).
so i would like to deserialize it from the "str" into "tab_1" (dim tab_1(n)
as string)

is it still possible? :)
 
The key is what method did you use to serialize it? Then you really just
have to reverse it.

Post the code you used to get from the array to the string and we will see
what we can do...
 
Uytkownik "Ray Cassick (Home) said:
Post the code you used to get from the array to the string and we will see
what we can do...
The key is what method did you use to serialize it? Then you really just
have to reverse it.

the array is serialized with php method "serialize".
then i add a reference to that method from vb .net env.

Dm m_abc As abc.pl.host.www
dim str as string
str=m_abc.users_list()

and the string str has the value:
a:2:{i:0;s:8:"element0";i:1;s:8:"element1";}.
now i have to split this to a vb array and don't know how.

greets,
messer
 
Hmmm I think you have me there. When you mentioned the term serialized I
figured you were talking like XML Serialization. The method you are talking
about seems to be different. Looks like they refer to serialize as more of a
linearization or flattening of the array into a string.

You might be able to get away with writing a function that takes the string,
reads through each of it's tokens and places them into your array.

Sorry, I can't offer much more since I am not knowledgeable in PHP at all.
 
Uzytkownik "Ray Cassick said:
Sorry, I can't offer much more since I am not knowledgeable in PHP at all.

ok ray. thank you for your response. i appreciate it.
greets,
messer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top