Home All Groups Group Topic Archive Search About

how to deserialize an array?

Author
27 Mar 2005 4:45 PM
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

Author
27 Mar 2005 5:23 PM
Ray Cassick (Home)
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.


Show quoteHide quote
"Messer" <inva***@email.com> wrote in message
news:d26o8k$il8$1@nemesis.news.tpi.pl...
> 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
>
>
>
Author
27 Mar 2005 5:56 PM
Messer
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? :)
Author
27 Mar 2005 9:04 PM
Ray Cassick (Home)
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...



Show quoteHide quote
"Messer" <inva***@email.com> wrote in message
news:d26sdg$9ed$1@nemesis.news.tpi.pl...
> 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? :)
>
>
Author
28 Mar 2005 8:23 AM
Messer
Uytkownik "Ray Cassick (Home)" <rcassickNOSPAM@enterprocity.com> napisal:
> 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
Author
28 Mar 2005 5:12 PM
Ray Cassick
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.



Show quoteHide quote
"Messer" <inva***@email.com> wrote in message
news:d28f99$65s$1@nemesis.news.tpi.pl...
> Uytkownik "Ray Cassick (Home)" <rcassickNOSPAM@enterprocity.com> napisal:
> > 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
>
>
>
Author
28 Mar 2005 7:12 PM
Messer
Uzytkownik "Ray Cassick" <rcassick@nospam.enterprocity.com> napisal:

> 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