FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » implode/explode vs serialize/unserialize
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: implode/explode vs serialize/unserialize [message #178310 is a reply to message #178306] Wed, 30 May 2012 20:35 Go to previous messageGo to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma:
Senior Member
On 5/30/2012 9:57 AM, Jerry Stuckle wrote:
> On 5/30/2012 9:26 AM, bill wrote:
>> 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
>
> Which would violate rdb normalization rules...
>

Yes I tried that before while experimenting.

I got lazy and just create a 'user_data' field to store some form data
without creating an actual field for each one.

Well it worked just fine and danady until I needed to do a search for a
particular value.

I then had to pull ALL the data, deserialize and search that data.

What a nightmare. But I did learn some new algorithms in the process.

I suppose sometimes it is our failures that teach us the best.

:)
Scotty
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: CFP - DEIS2012 - Czech Republic - SDIWC
Next Topic: PHP Concatenate
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 04:12:40 GMT 2024

Total time taken to generate the page: 0.04457 seconds