Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6224

Re: implode/explode vs serialize/unserialize

From bill <william@TechServSys.com>
Newsgroups comp.lang.php
Subject Re: implode/explode vs serialize/unserialize
Date 2012-05-30 09:26 -0400
Organization Aioe.org NNTP Server
Message-ID <jq576g$phf$1@speranza.aioe.org> (permalink)
References <jq2im6$u4p$1@speranza.aioe.org> <4fc4dae4$0$6908$e4fe514c@news2.news.xs4all.nl>

Show all headers | View raw


On 5/29/2012 10:19 AM, Erwin Moller wrote:
> On 5/29/2012 3:24 PM, bill wrote:
>> Would one of the more knowledgeable folk discuss when it is
>> appropriate
>> to use implode/explode and when it is appropriate to use
>> serialize/unserialize.
>>
>> It seems that for 1D arrays implode is better in that is only
>> adds 1
>> character per array element and serialize adds many.
>>
>> For objects, serialze is the only way to go.
>>
>> in between ?
>>
>> bill
>
> That is a vague question without more context.
> Shooting from the hip I would suggest you use serialize only if
> you need to store/transport a complex structure.
> And use implode and explode only when you want to create a string
> from a simple array (no arrays in arrays), and the other way around.
>
>

Erwin,

Your shot from the hip is exactly what I was looking for - thanks.

As a learner of PHP, the context is that both are used to convert 
arrays to a form that can be stored in a mysql database.

bill

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

implode/explode vs serialize/unserialize bill <william@TechServSys.com> - 2012-05-29 09:24 -0400
  Re: implode/explode vs serialize/unserialize Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-29 09:53 -0400
  Re: implode/explode vs serialize/unserialize Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-05-29 16:19 +0200
    Re: implode/explode vs serialize/unserialize Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-05-29 16:22 +0200
    Re: implode/explode vs serialize/unserialize bill <william@TechServSys.com> - 2012-05-30 09:26 -0400
      Re: implode/explode vs serialize/unserialize Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-30 12:57 -0400
        Re: implode/explode vs serialize/unserialize Scott Johnson <noonehome@chalupasworld.com> - 2012-05-30 13:35 -0700
          Re: implode/explode vs serialize/unserialize Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-30 17:37 -0400
            Re: implode/explode vs serialize/unserialize Scott Johnson <noonehome@chalupasworld.com> - 2012-05-31 16:45 -0700
      Re: implode/explode vs serialize/unserialize Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-05-30 20:37 +0200
      Re: implode/explode vs serialize/unserialize Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-30 22:34 +0200
  Re: implode/explode vs serialize/unserialize Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-29 16:07 +0200

csiph-web