开发者

Uses of serialize() in php [closed]

开发者 https://www.devze.com 2023-02-05 14:19 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. 开发者_如何转开
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. 开发者_如何转开发For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Uses of serialize() in php.its advantages and dis advantages


Advantages:

Turns objects into a string

Disadvantages:

Turns objects into a string


Disadvantages

  • Resources are not serialized, and have to be manually recreated when unserialized
  • Implementation has a number of open bugs

Advantages

PHP provides magic methods allowing you to handle this disadvantage


I dont see any disadvantage of serialization.

Advantage is that you can serialize objects and arrays and save them (for example in database). Later, you can get objects back (unserialize) in the exactly same state, in which they were saved.


http://us2.php.net/manual/en/function.serialize.php


It turns the object or array passed to it as the first (and only) argument to a string. This function is useful for storing objects in a database or file, for example. To turn the string back into an object or array, use unserialize(). Also look at the documentation of the function at: http://us2.php.net/manual/en/function.serialize.php


Only disadvantage is with utf8 encoding!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号