Zend Exam Tips – be careful with serialize

In the last mock exam that I did I made the same mistake twice: the “serialize” mistake. If you have read my post Zend Exam Tips III you will see that I believed that unserialize would take care of a string that seemed to be serialized. This time my mistake was over the serialize function. The question was simple:

The _______ function is used to convert an array into a string, maintaining your ability to return the string into an array.

Believe it or not, that’s not the concept of serialize function, that’s the concept of the implode function. Even knowing that I have used the implode function to perform exactly what have been described, I haven’t remembered that during the exam because “serialize” seems so obvious for being the correct question.

If you are preparing yourself to do the Zend Exam, be more than careful with the “serialize” concept.

Just to help you out, in accordance with PHP.Net, the serialize function is:

Description

string serialize ( mixed $value )

Generates a storable representation of a value

This is useful for storing or passing PHP values around without losing their type and structure.

To make the serialized string into a PHP value again, use unserialize().

Advertisements

About mcloide

Making things simpler, just check: http://www.mcloide.com View all posts by mcloide

One response to “Zend Exam Tips – be careful with serialize

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: