Re: Suggestion for dbm functions
| From: | Lars Christensen | Date: | Wed, 03 Mar 1999 08:35:23 +0000 |
| Subject: | Re: Suggestion for dbm functions | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-4456@lists.php.net to get a copy of this message | ||
On Tue, 2 Mar 1999, Rasmus Lerdorf wrote:
> > I suggest thet the two functions dbmstore and dbmfetch take any variably
> > type as parameter instead of only strings so that you can store any data
> > type, even arrays and objects. This would indeed make the dbm functions
> > usable for more purposes.
> >
> > I have only gdbm available here, but from the documentation supplied, I
> > know that you can easily store binary data and not just strings.
> >
> > Making this change would even not break existing php3 sources, as strings
> > would still be strings.
>
> I don't think it makes much sense to make this specific to the dbm
> functions. There are already functions that take any PHP data structure
> and convert it to a string and back. See the serialize() function, for
> example.
Well, much space could be saved by using a binary representation instead
of the string representation. Also, parsing a string must be less
efficient. Finally, the format that serialize() uses seems for me to have
much overhead. An array of 6 integers take up (at least) 50 bytes. That is
when I use small integer values. Higher values (10 digit for example)
makes the overhead would be much worse.
/Lars Christensen
larsch@cs.auc.dk
http://www.cs.auc.dk/~larsch
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net