Nolongerused3921 Posted December 28, 2006 Share Posted December 28, 2006 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 More sharing options...
kenrbnsn Posted December 28, 2006 Share Posted December 28, 2006 To be able to use the unserialize() function you would have to create the string in a very specific format.Ken Link to comment https://forums.phpfreaks.com/topic/32102-unserialize-vs-multiple-explodes/#findComment-148979 Share on other sites More sharing options...
Nolongerused3921 Posted December 28, 2006 Author Share Posted December 28, 2006 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. Link to comment https://forums.phpfreaks.com/topic/32102-unserialize-vs-multiple-explodes/#findComment-148980 Share on other sites More sharing options...
kenrbnsn Posted December 28, 2006 Share Posted December 28, 2006 That would work.Ken Link to comment https://forums.phpfreaks.com/topic/32102-unserialize-vs-multiple-explodes/#findComment-148987 Share on other sites More sharing options...
Nolongerused3921 Posted December 28, 2006 Author Share Posted December 28, 2006 Yes but how much faster is it then exploding multiple times and all that? Link to comment https://forums.phpfreaks.com/topic/32102-unserialize-vs-multiple-explodes/#findComment-148988 Share on other sites More sharing options...
kenrbnsn Posted December 28, 2006 Share Posted December 28, 2006 I couldn't tell you, since I've never tested it or thought about it.Ken Link to comment https://forums.phpfreaks.com/topic/32102-unserialize-vs-multiple-explodes/#findComment-148990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.