Re: Knowing size in bytes of an object / a variable ?
| From: | Andreas Pour | Date: | Mon, 24 Jul 2000 10:35:07 +0000 |
| Subject: | Re: Knowing size in bytes of an object / a variable ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7848@lists.php.net to get a copy of this message | ||
Yes, you are right. So you have two solutions: use a database or write
your own. If you write your own, you probably need two files, one as an
index and the other to hold the data (though it gets kind of ugly if you
delete a lot). When writing to the file, first "serialize" the object,
then record its starting location and length in your index.
Ciao,
Andreas
Francois Bare wrote:
>
> I can't save objects in a file cause I don't know its size.
> So if I want fputs to write the entire object, I can't get it back with fgets or fread
> since I must pass a "size" parameter.
>
> Thank you.
>
> ------------------------------------------------------------
> Want a free mail at http://www.mail.be ?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net