Jump to content

Unserialize() vs multiple explodes


Nolongerused3921

Recommended Posts

Well I'm rethinking my current way of saving permission data to my db, seeing as I have to explode it multiple times before its any use to me... How much faster is unserialize() compared to exploding a string like below to get just the hex?

[code]
article:0x0000000E;user:0x00000003;
[/code]
(Have to explode ;, then match article, then explode :, then take array[1] to get the hex)

Any tips or comments for using serialize()/unserialize() and saving to a mysql table?
Link to comment
https://forums.phpfreaks.com/topic/32102-unserialize-vs-multiple-explodes/
Share on other sites

I was planning on serializing an array that was setup like:
[code=php:0]
$permissions = array(
'articles' => 0x0000000E,
'user' => 0x00000003);
[/code]

Then I could just take that, serialize it, put into db... Then pull it down again, unserialize it, call $permission[articles] and have my hex.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.